C
C#4mo ago
Tandy

Regex negative lookahead not working

I am trying to use regular expressions to detect URLs in dynamic text (I know). I have a pretty good working example, but I'm struggling to filter out certain HTML codes that could be present in the dynamic text. For example, the current regex is capturing google.com&#160 as the URL for the following text: visit us at google.com for more information. I'd like to prevent that and only match on google.com. I tried to add a negative lookahead to remove matches on &#160, but it's not working. Can anyone help? https://regex101.com/r/WJ6y2x/2
2 Replies
Tandy
Tandy4mo ago
ideally yeah For the example you mentioned yeah.. if it's the end of a sentence, though, I would want to exclude it. Like, visit google.com? would match google.com fair enough. it must be working by coincidence based on word boundaries
Mayor McCheese
Mayor McCheese4mo ago
^this$ though
Want results from more Discord servers?
Add your server