Given this PCRE pattern:
/(<name>[^<>]*<\/name>[^<>]*<phone>[^<>]*<\/phone>)/
And this subject text:
<name>John Stevens</name> <phone>888-555-1212</phone>
<name>Peter Wilson</name>
<phone>888-555-2424</phone>
How can I get the Regular Expression to match the first name-phone pair but not the second? I don't want to match pairs that are separated by line breaks. I tried including an end-of-line in the negated character class like so [^<>$]* but nothing changed.
You can use the following online tools to test your expressions:
http://rubular.com/
http://www.regextester.com/
Thank you.
$loses its special meaning and becomes simply a literal dollar sign. What you want is:[^<>\r\n]as sawa suggests.