Вопрос

I have this Regex expression

UriPatternToMatch= new Regex(@"(href|src)=""[\d\w\/:#@%;$\(\)~_\?\+\-=\\\.&]*", 
RegexOptions.Compiled | RegexOptions.IgnoreCase)

This is working fine to pickup all URLS including http,ftp and others , but it picks up text within "&lt" special characters as URL too

for example it will wrongly pick up the text below as a URL too ( adding a photo instead of text below)

snapshot

I believe something like ^&lt is what is needed , but where do I add it ?

Thanks

Это было полезно?

Решение

You need to use negative lookahead like this:

(?!.*?<)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top