javascript - Regex for finding all text urls but not in images src -


i'm replacing text urls on page clickable.
when replaces links in 'src' attribute of images (which not desired)

my regex this

[-a-za-z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-za-z0-9@:%_\+.~#?&//=]*)? 

i tried negative search

(?!src\=\")[-a-za-z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-za-z0-9@:%_\+.~#?&//=]*)? 

but dosn't match thing.

how should precede regex?

how this...

(?:(href="))([-a-za-z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-za-z0-9@:%_\+.~#?&//=]*)?)(?:([^>]*>[^<]*</a>)) 

i added non-capturing groups beginning , end verify it's anchor href. tested page's source @ http://regexpal.com/


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -