[PHP-DOC] cvs: phpdoc /en/functions pcre.xml From: Monte Ohrt (monte <email protected>)
Date: 07/31/00

mohrt Mon Jul 31 08:31:46 2000 EDT

  Modified files:
    /phpdoc/en/functions pcre.xml
  Log:
  update preg_match_all() example
  
  
Index: phpdoc/en/functions/pcre.xml
diff -u phpdoc/en/functions/pcre.xml:1.22 phpdoc/en/functions/pcre.xml:1.23
--- phpdoc/en/functions/pcre.xml:1.22 Fri Jul 28 14:27:09 2000
+++ phpdoc/en/functions/pcre.xml Mon Jul 31 08:31:46 2000
@@ -248,6 +248,9 @@
      <example>
       <title>Find matching HTML tags (greedy)</title>
       <programlisting role="php">
+// 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 = "&lt;b&gt;bold text&lt;/b&gt;&lt;a href=howdy.html&gt;click me&lt;/a&gt;
 
 preg_match_all ("/(&lt;([\w]+)[^&gt;]*&gt;)(.*)(&lt;\/\\2&gt;)/", $html, $matches);