mirror of
https://github.com/balzack/databag.git
synced 2025-04-19 16:15:16 +00:00
fixing url pattern on mobile
This commit is contained in:
parent
38a637e5cb
commit
d0e69246cc
@ -61,6 +61,7 @@ export function Message({
|
||||
useEffect(() => {
|
||||
const urlPattern = new RegExp('(https?:\\/\\/)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,4}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)');
|
||||
const hostPattern = new RegExp('^https?:\\/\\/', 'i');
|
||||
const dotPattern = new RegExp('^.*\\.\\..*$')
|
||||
|
||||
let plain = '';
|
||||
let clickable = [];
|
||||
@ -69,7 +70,7 @@ export function Message({
|
||||
if (parsed?.length > 0) {
|
||||
const words = parsed as string[];
|
||||
words.forEach((word, index) => {
|
||||
if (urlPattern.test(word)) {
|
||||
if (urlPattern.test(word) && !dotPattern.test(word)) {
|
||||
clickable.push(
|
||||
<Text key={index} style={textStyle}>
|
||||
{plain}
|
||||
|
Loading…
x
Reference in New Issue
Block a user