Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Regular Exrepssion Negative Look ahead problem

  •  01-10-2009, 1:49 AM

    Regular Exrepssion Negative Look ahead problem

    I am very new to regular expressions. I have a senario in my java script where i m using regular expression. i have a long html string contain tags like

    1. <IMG src="path/myImage1.jpg" alt="blah" border="0"/>

    2. <IMG src="path/myImageTwo.jpg" alt="xyz" border="0"/>

    and there are some other <IMG../> tags which contains button like two below

    3. <IMG src="path/buttonRed.jpg" alt="blah" border="0"/>

    4. <IMG src="path/buttonBlue.jpg" alt="blah" border="0"/>

    I need to remove all the <IMG src.../> tags from the html string i have that DOESN'T contain button in the tag, i.e. I need to remove 1 & 2 but NOT 3& 4

    I have my regular expression </?[iI][mM][gG][ ][^>]*> but that removes all <IMG src../> tags. I m looking for something with negative lookaheads. But i was not able to find the right solution. Any help will greatly appreciated.

View Complete Thread