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
Post a Comment