Re: [PATCH] preg_match and preg_match_all

From: Date: Tue, 12 Oct 2004 10:08:58 +0000
Subject: Re: [PATCH] preg_match and preg_match_all
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969364512@lists.php.net to get a copy of this message
Hi Andrey, The texts are okay, you'll find some comments on the structure : Andrey Demenev wrote:
Index: preg-match-all.xml ===================================================================
+    <note>
+     <para>
+      Using <parameter>offset</parameter> is not equivalent to
+      passing <function>substr</function>($subject, $offset) to
This will be rendered as : passing substr()($subject, $offset) and I don't think it's what you want. You may try something like <literal>substr($subject, $offset)</literal>. This also apply to the other page.
+      <function>preg_match_all</function> in place of the subject string,
+      because <parameter>pattern</parameter> can contain assertions such as
+      <emphasis>^</emphasis>, <emphasis>$</emphasis> or
+      <emphasis>(?&lt;=x)</emphasis>. See <function>preg_match</function> for
+      examples.
+     </para>
+    </note>
Index: preg-match.xml ===================================================================
+     <informalexample>
+      <programlisting role="php">
+<![CDATA[ +<?php
+    $subject = "abcdef";
+    $pattern = '/^def/';
+    preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, 3);
+    print_r($matches);
+?>
The example should start at column 0 (no tab before $subject)
+]]>
+      </programlisting>
+      <para>
+       will produce
+      </para>
We introduced an entity for this kind of stuff : &example.outputs; You should use it like this : <programlisting> </programlisting> &example.outputs; <screen> </screen>
+      <screen>
+<![CDATA[ +Array +( +) +]]>
+      </screen>
+      <para>
+       and
"While this example"
+      </para>
+      <programlisting role="php">
+<![CDATA[ +<?php
+    $subject = "abcdef";
+    $pattern = '/^def/';
+    preg_match($pattern, substr($subject,3), $matches, PREG_OFFSET_CAPTURE);
+    print_r($matches);
+?> +]]>
+      </programlisting>
+      <para>
+       will produce
Don't use &example.outputs; here, your suggestion is okay for the second example. Thank you a lot for your patch, didou

« previous php.doc (#969364512) next »