twitter / twitter-text

Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.
https://developer.twitter.com/en/docs/counting-characters
Apache License 2.0
3.07k stars 520 forks source link

regex expression for validUrlQueryChars unable to identify URI Template #422

Open AjayKumar-25 opened 7 months ago

AjayKumar-25 commented 7 months ago

Describe the bug I am using validUrlQueryChars regex ( i.e. /[a-z0-9!?*'@();:&=+\$\/%#[]-_.,~|]/i; ) to detect an URI with Template but it is not detecting complete url

To Reproduce

example url - https://abc.com/path?param={VARIABLE}

Using above regex for matching query params for given url, it's only able to identify https://abc.com/path?param= this as the matched URL

Expected behavior The regex should be able to match complete url i.e. https://abc.com/path?param={VARIABLE}

Please suggest.