URL parser with single quote not working
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
@pierroo you can use Telegram's regex
https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/messenger/LinkifyPort.java
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
@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}`);
},
}
