MAMP/LAMP backreference syntax?
This should be fairly simple, but it keeps failing (w/o reporting any errors) so I assume I am missing something from the syntax OR I have configred MAMP wrong.
Basically I am trying to use a back reference within my preg_match. for example, to match tag, any tag, and its contents.
The first (and only) capturing group gathers the 'tag' and the \1 backreferences the capture pattern. have This works (as far as the simple test of finding a tag) on just about any PURE regexp tester, but on my local installation of MAMP (PHP 5.26) it always returns FALSE. Is there a difference syntax for backreferences in MAMP or did I go astray here in some other fashion?
$a="<em>some text goes here.</em>dshashd xxc dsfa";
$r=preg_match("/<([a-z]+)>[^<]*<\/\1>/", $a, $match);
echo ($r)? $match: "nope";