문제

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