svn: /phpdoc/en/trunk/reference/pcre/ functions/preg-replace.xml pattern.modifiers.xml

From: Date: Sun, 04 Dec 2011 21:54:27 +0000
Subject: svn: /phpdoc/en/trunk/reference/pcre/ functions/preg-replace.xml pattern.modifiers.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-9146@lists.php.net to get a copy of this message
frozenfire Sun, 04 Dec 2011 21:54:27 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=320388 Log: Removed eval modifier example from preg_replace reference. Added caution to eval modifier reference about its addslashes behaviour. Changed paths: U phpdoc/en/trunk/reference/pcre/functions/preg-replace.xml U phpdoc/en/trunk/reference/pcre/pattern.modifiers.xml Modified: phpdoc/en/trunk/reference/pcre/functions/preg-replace.xml =================================================================== --- phpdoc/en/trunk/reference/pcre/functions/preg-replace.xml 2011-12-04 21:47:15 UTC (rev 320387) +++ phpdoc/en/trunk/reference/pcre/functions/preg-replace.xml 2011-12-04 21:54:27 UTC (rev 320388) @@ -271,24 +271,6 @@ </para> <para> <example> - <title>Using the 'e' modifier</title> - <programlisting role="php"> -<![CDATA[ -<?php -preg_replace("/(<\/?)(\w+)([^>]*>)/e", - "'\\1'.strtoupper('\\2').'\\3'", - $html_body); -?> -]]> - </programlisting> - <para> - This would capitalize, and escape all single quotes, double quotes, - backslashes and NULL characters, in HTML tags in the input text. - </para> - </example> - </para> - <para> - <example> <title>Strip whitespace</title> <para> This example strips excess whitespace from a string. Modified: phpdoc/en/trunk/reference/pcre/pattern.modifiers.xml =================================================================== --- phpdoc/en/trunk/reference/pcre/pattern.modifiers.xml 2011-12-04 21:47:15 UTC (rev 320387) +++ phpdoc/en/trunk/reference/pcre/pattern.modifiers.xml 2011-12-04 21:54:27 UTC (rev 320388) @@ -87,13 +87,23 @@ Single quotes, double quotes, backslashes (<literal>\</literal>) and NULL chars will be escaped by backslashes in substituted backreferences. </simpara> - <tip> + <caution> <para> + The addslashes function is run on each matched backreference before + the substitution takes place. As such, when the backreference + is used as a quoted string, escaped characters will be converted + to literals. However, characters which are escaped, which would + normally not be converted, will retain their slashes. This makes + use of this modifier very complicated. + </para> + </caution> + <caution> + <para> Make sure that <parameter>replacement</parameter> constitutes a valid PHP code string, otherwise PHP will complain about a parse error at the line containing <function>preg_replace</function>. </para> - </tip> + </caution> <note> <para> Only <function>preg_replace</function> uses this modifier;

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