mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Fix parameter typo: order->flags. Added <?php ?> to examples.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@105987 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
970fedb064
commit
79dccfdae9
1 changed files with 10 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- splitted from ./en/functions/pcre.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.preg-match-all">
|
||||
<refnamediv>
|
||||
|
@ -19,7 +19,7 @@
|
|||
Searches <parameter>subject</parameter> for all matches to the regular
|
||||
expression given in <parameter>pattern</parameter> and puts them in
|
||||
<parameter>matches</parameter> in the order specified by
|
||||
<parameter>order</parameter>.
|
||||
<parameter>flags</parameter>.
|
||||
</para>
|
||||
<para>
|
||||
After the first match is found, the subsequent searches are continued
|
||||
|
@ -41,11 +41,13 @@
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
preg_match_all ("|<[^>]+>(.*)</[^>]+>|U",
|
||||
"<b>example: </b><div align=left>this is a test</div>",
|
||||
$out, PREG_PATTERN_ORDER);
|
||||
print $out[0][0].", ".$out[0][1]."\n";
|
||||
print $out[1][0].", ".$out[1][1]."\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
|
@ -73,11 +75,13 @@ example: , this is a test
|
|||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
preg_match_all ("|<[^>]+>(.*)</[^>]+>|U",
|
||||
"<b>example: </b><div align=left>this is a test</div>",
|
||||
$out, PREG_SET_ORDER);
|
||||
print $out[0][0].", ".$out[0][1]."\n";
|
||||
print $out[1][0].", ".$out[1][1]."\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -125,8 +129,10 @@ print $out[1][0].", ".$out[1][1]."\n";
|
|||
<title>Getting all phone numbers out of some text.</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
preg_match_all ("/\(? (\d{3})? \)? (?(1) [\-\s] ) \d{3}-\d{4}/x",
|
||||
"Call 555-1212 or 1-800-555-1212", $phones);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@ -136,6 +142,7 @@ preg_match_all ("/\(? (\d{3})? \)? (?(1) [\-\s] ) \d{3}-\d{4}/x",
|
|||
<title>Find matching HTML tags (greedy)</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// The \\2 is an example of backreferencing. This tells pcre that
|
||||
// it must match the second set of parentheses in the regular expression
|
||||
// itself, which would be the ([\w]+) in this case. The extra backslash is
|
||||
|
@ -150,6 +157,7 @@ for ($i=0; $i< count($matches[0]); $i++) {
|
|||
echo "part 2: ".$matches[3][$i]."\n";
|
||||
echo "part 3: ".$matches[4][$i]."\n\n";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
|
Loading…
Reference in a new issue