Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL parser with single quote not working #124

Open
pierroo opened this issue Feb 7, 2023 · 3 comments
Open

URL parser with single quote not working #124

pierroo opened this issue Feb 7, 2023 · 3 comments

Comments

@pierroo
Copy link

pierroo commented Feb 7, 2023

I just realized the url parser would stop the link parsing as soon as there is a single quote.

I got surprised, but it was brought to my attention by a user using this example:
https://en.wikipedia.org/wiki/Witold's_Report

it will stop at Witold and the rest won't be caught

@hantrungkien
Copy link

@pierroo
Copy link
Author

pierroo commented Apr 11, 2023

Thank you for sharing @hantrungkien , that's quite a wild one! :D
Not sure though how to compile it all into a single javascript regex that could trigger parsedText

@hantrungkien
Copy link

hantrungkien commented Apr 11, 2023

@pierroo I'm sure for work. Just convert to regex for javascript and change a little bit and use

const PROTOCOL = '(?:http|https|ton|tg):\\/\\/';
const LABEL_CHAR = 'a-zA-Z0-9';
{
            pattern: new RegExp(WEB_URL, 'gim'),
            style: {color: 'blue', textDecorationLine: 'underline'},
            onPress: (text, index) => {
              console.log(`url = ${text}, index = ${index}`);
            },
}

IMG_9061

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants