andrei Mon Jan 22 14:27:42 2001 EDT
Modified files:
/phpdoc/en/functions pcre.xml
Log:
Docs for /F modifier and matching delimeters.
Index: phpdoc/en/functions/pcre.xml
diff -u phpdoc/en/functions/pcre.xml:1.34 phpdoc/en/functions/pcre.xml:1.35
--- phpdoc/en/functions/pcre.xml:1.34 Wed Nov 15 07:01:03 2000
+++ phpdoc/en/functions/pcre.xml Mon Jan 22 14:27:41 2001
@@ -6,10 +6,11 @@
<para>
The syntax for patterns used in these functions closely resembles
Perl. The expression should be enclosed in the delimiters, a
- forward slash (/), for example. Any character can be used for
+ forward slash (/), for example. Any character can be used for
delimiter as long as it's not alphanumeric or backslash (\). If
the delimiter character has to be used in the expression itself,
- it needs to be escaped by backslash.
+ it needs to be escaped by backslash. Since PHP 4.0.4, you can also use
+ Perl-style (), {}, [], and <> matching delimiters.
</para>
<para>
The ending delimiter may be followed by various modifiers that
@@ -23,6 +24,7 @@
<listitem><simpara>/<\/\w+>/</simpara></listitem>
<listitem><simpara>|(\d{3})-\d+|Sm</simpara></listitem>
<listitem><simpara>/^(?i)php[34]/</simpara></listitem>
+ <listitem><simpara>{^\s+(\s+)?$}</simpara></listitem>
</itemizedlist>
</example>
</para>
@@ -363,6 +365,13 @@
the line containing <function>preg_replace</function>.
</para>
<para>
+ </literal>/F</literal> modifier means that the
+ <parameter>replacement</parameter> is taken to be a function name. This
+ function will be called and passed an array of matched elements in the
+ subject string. The function should return the replacement string. This
+ modifier was added in PHP 4.0.4.
+ </para>
+ <para>
<example>
<title>Replacing several values</title>
<programlisting>
@@ -694,11 +703,29 @@
If this modifier is set, <function>preg_replace</function>
does normal substitution of backreferences in the
replacement string, evaluates it as PHP code, and uses the
- result for replacing the search string.
+ result for replacing the search string. This modifier cannot be used along
+ with <literal>/F modifier</literal>.
</simpara>
<simpara>
Only <function>preg_replace</function> uses this modifier;
it is ignored by other PCRE functions.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><emphasis>F</emphasis></term>
+ <listitem>
+ <simpara>
+ If this modifier is set, <function>preg_replace</function>
+ treats the replacement parameter as a function name that should be called
+ to provide the replacement string. The function is passed an array of
+ matched elements in the subject string. This modifier cannot be used along
+ with <literal>/e modifier</literal>.
+ </simpara>
+ <simpara>
+ Only <function>preg_replace</function> uses this modifier;
+ it is ignored by other PCRE functions. This modifier was added in PHP
+ 4.0.4.
</simpara>
</listitem>
</varlistentry>