regex - PHP regular expression subpattern behaviour -


I want to match both source and title attributes of an image tag:

Pattern: < / P>

  & lt; Img [^ & gt;] * src = ["| \ '] ([^" | \'] + ["| \ ']) | title = [" | \ '] ([^ "| \'] +)  

Target:

   

So, my matches are:

   

Do avoid the third of these matches Is there any way to do this? I am using PCE in PHP 5.2.x

If you really Try what you want:

  src = "(. +?)" | Title = "(. +?)"  

I also advise you to do some games which is an online regx in Flash ... it improves your knowledge Can help regions and many expressions already built by the community with it.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -