diff --git a/functions/pcre.xml b/functions/pcre.xml index ba14dee679..b120037a7f 100644 --- a/functions/pcre.xml +++ b/functions/pcre.xml @@ -248,6 +248,9 @@ preg_match_all ("/\(? (\d{3})? \)? (?(1) [\-\s] ) \d{3}-\d{4}/x", Find matching HTML tags (greedy) +// the \\2 is an example of backreferencing. This tells pcre that +// it must match the 2nd set of parenthesis in the regular expression +// itself, which would be the ([\w]+) in this case. $html = "<b>bold text</b><a href=howdy.html>click me</a> preg_match_all ("/(<([\w]+)[^>]*>)(.*)(<\/\\2>)/", $html, $matches);