cvs: phpdoc /en/reference/pcre/functions preg-match-all.xml preg-match.xml

From: Date: Thu, 24 Jan 2008 17:04:27 +0000
Subject: cvs: phpdoc /en/reference/pcre/functions preg-match-all.xml preg-match.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-1075@lists.php.net to get a copy of this message
felipe Thu Jan 24 17:04:27 2008 UTC Modified files: /phpdoc/en/reference/pcre/functions preg-match-all.xml preg-match.xml Log: Add example (using named subpattern) http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/pcre/functions/preg-match-all.xml?r1=1.25&r2=1.26&diff_format=u Index: phpdoc/en/reference/pcre/functions/preg-match-all.xml diff -u phpdoc/en/reference/pcre/functions/preg-match-all.xml:1.25 phpdoc/en/reference/pcre/functions/preg-match-all.xml:1.26 --- phpdoc/en/reference/pcre/functions/preg-match-all.xml:1.25 Fri Aug 17 03:00:29 2007 +++ phpdoc/en/reference/pcre/functions/preg-match-all.xml Thu Jan 24 17:04:26 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.25 $ --> +<!-- $Revision: 1.26 $ --> <refentry xml:id="function.preg-match-all" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>preg_match_all</refname> @@ -269,6 +269,71 @@ </screen> </example> </para> + <para> + <example> + <title>Using named subpattern</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$str = <<<FOO +a: 1 +b: 2 +c: 3 +FOO; + +preg_match_all('/(?<name>\w+): (?<digit>\d+)/', $str, $matches); + +print_r($matches); + +?> +]]> + </programlisting> + &example.outputs; + <screen role="html"> +<![CDATA[ +Array +( + [0] => Array + ( + [0] => a: 1 + [1] => b: 2 + [2] => c: 3 + ) + + [name] => Array + ( + [0] => a + [1] => b + [2] => c + ) + + [1] => Array + ( + [0] => a + [1] => b + [2] => c + ) + + [digit] => Array + ( + [0] => 1 + [1] => 2 + [2] => 3 + ) + + [2] => Array + ( + [0] => 1 + [1] => 2 + [2] => 3 + ) + +) +]]> + </screen> + </example> + </para> </refsect1> <refsect1 role="seealso"> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/pcre/functions/preg-match.xml?r1=1.26&r2=1.27&diff_format=u Index: phpdoc/en/reference/pcre/functions/preg-match.xml diff -u phpdoc/en/reference/pcre/functions/preg-match.xml:1.26 phpdoc/en/reference/pcre/functions/preg-match.xml:1.27 --- phpdoc/en/reference/pcre/functions/preg-match.xml:1.26 Fri Aug 17 03:00:29 2007 +++ phpdoc/en/reference/pcre/functions/preg-match.xml Thu Jan 24 17:04:27 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.26 $ --> +<!-- $Revision: 1.27 $ --> <refentry xml:id="function.preg-match" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>preg_match</refname> @@ -266,6 +266,37 @@ </screen> </example> </para> + <para> + <example> + <title>Using named subpattern</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$str = 'foobar: 2008'; + +preg_match('/(?<name>\w+): (?<digit>\d+)/', $str, $matches); + +print_r($matches); + +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Array +( + [0] => foobar: 2008 + [name] => foobar + [1] => foobar + [digit] => 2008 + [2] => 2008 +) +]]> + </screen> + </example> + </para> </refsect1> <refsect1 role="notes">

« previous php.doc.cvs (#1075) next »