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

Advanced HTML Tags Matcher

  •  10-20-2008, 1:20 PM

    Advanced HTML Tags Matcher

    Hello,

    I'm trying to extract all html tags from a string using PHP. I use the following regexp:

     /<[^>]+>/i

    If the string contains "<img src="image.jpg"><span id="spanID">Text Here</span>" the regex gives me the desired result. However if I have a string like: "<img alt="Image title >> Image description" src="image.jpg"> <span id="spanID">Text Here</span>" it doesn't return me the expected results. This is because the regex doesn't ignore the right arrow(s) (from ALT) between single or double quotes. Any ideas how this can be solved? I prefer to use a single regex to solve this, without using any other PHP functions. 

    Any ideas?

    Liviu

     

     

View Complete Thread