Date: 07/20/00
- Next message: Monte Ohrt: "[PHP-DOC] cvs: phpdoc /en/functions pcre.xml"
- Previous message: Uwe Steinmann: "[PHP-DOC] cvs: phpdoc /en/functions network.xml pcre.xml"
- Next in thread: Monte Ohrt: "[PHP-DOC] cvs: phpdoc /en/functions pcre.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
mohrt Thu Jul 20 12:09:09 2000 EDT
Modified files:
/phpdoc/en/functions pcre.xml
Log:
added example to preg_match_all()
Index: phpdoc/en/functions/pcre.xml
diff -u phpdoc/en/functions/pcre.xml:1.11 phpdoc/en/functions/pcre.xml:1.12
--- phpdoc/en/functions/pcre.xml:1.11 Thu Jul 20 11:35:38 2000
+++ phpdoc/en/functions/pcre.xml Thu Jul 20 12:09:09 2000
@@ -225,6 +225,35 @@
</programlisting>
</example>
</para>
+ <para>
+ <example>
+ <title>Find matching HTML tags (greedy)</title>
+ <programlisting role="php">
+$html = "<b>bold text<b>lt;a href=howdy.html>click me<a>
+
+preg_match_all("/(<w]+)[^>lt;2> $html, $matches);
+
+for($i=0; $i< count($matches[0]); $i++) {
+echo "matched: ".$matches[0][$i]."\n";
+echo "part 1: ".$matches[1][$i]."\n";
+echo "part 2: ".$matches[3][$i]."\n";
+echo "part 3: ".$matches[4][$i]."\n\n";
+}
+ </programlisting>
+ </example>
+ This example will produce:
+ <programlisting>
+matched: <b>bold text<b>
+part 1: <b>
+part 2: bold text
+part 3: <b>
+
+matched: <a href=howdy.html>click me<a>
+part 1: <a href=howdy.html>
+part 2: click me
+part 3: <a>
+ </programlisting>
+ </para>
<simpara>
See also <function>preg_match</function>,
<function>preg_replace</function>,
- Next message: Monte Ohrt: "[PHP-DOC] cvs: phpdoc /en/functions pcre.xml"
- Previous message: Uwe Steinmann: "[PHP-DOC] cvs: phpdoc /en/functions network.xml pcre.xml"
- Next in thread: Monte Ohrt: "[PHP-DOC] cvs: phpdoc /en/functions pcre.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

