cvs: phpdoc-zh /reference/regex/functions ereg-replace.xml eregi-replace.xml split.xml sql-regcase.xml

From: Date: Sun, 21 Sep 2003 19:53:28 +0000
Subject: cvs: phpdoc-zh /reference/regex/functions ereg-replace.xml eregi-replace.xml split.xml sql-regcase.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-1753@lists.php.net to get a copy of this message
dallas Sun Sep 21 15:53:28 2003 EDT Added files: /phpdoc-zh/reference/regex/functions ereg-replace.xml eregi-replace.xml split.xml sql-regcase.xml Log: Completed.

Index: phpdoc-zh/reference/regex/functions/ereg-replace.xml +++ phpdoc-zh/reference/regex/functions/ereg-replace.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.ereg-replace"> <refnamediv> <refname>ereg_replace</refname> <refpurpose>Ìæ»»ÕýÔò±í´ïʽ</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>string</type><methodname>ereg_replace</methodname> <methodparam><type>string</type><parameter>pattern</parameter></methodparam> <methodparam><type>string</type><parameter>replacement</parameter></methodparam> <methodparam><type>string</type><parameter>string</parameter></methodparam> </methodsynopsis> <simpara> ±¾º¯ÊýÔÚ <parameter>string</parameter> ÖÐɨÃèÓë <parameter>pattern</parameter> Æ¥ÅäµÄ²¿·Ö£¬²¢½«ÆäÌæ»»Îª <parameter>replacement</parameter>¡£ </simpara> <simpara> ·µ»ØÌæ»»ºóµÄ×Ö·û´®¡££¨Èç¹ûûÓпɹ©Ìæ»»µÄÆ¥ÅäÏîÔò»á·µ»ØÔ­×Ö·û´®¡££© </simpara> <simpara> Èç¹û <parameter>pattern</parameter> °üº¬ÓÐÀ¨ºÅÄÚµÄ×Ó´®£¬Ôò <parameter>replacement</parameter> ¿ÉÒÔ°üº¬ÐÎÈç <literal>\\<replaceable>digit</replaceable></literal> µÄ×Ó´®£¬ÕâЩ×Ó´®½«±»Ì滻ΪÊý×Ö±íʾµÄµÄµÚ¼¸¸öÀ¨ºÅÄÚµÄ×Ó´®£»<literal>\\0</literal> Ôò°üº¬ÁË×Ö·û´®µÄÕû¸öÄÚÈÝ¡£×î¶à¿ÉÒÔÓþŸö×Ó´®¡£À¨ºÅ¿ÉÒÔǶÌ×£¬´ËÇéÐÎÏÂÒÔ×óÔ²À¨ºÅÀ´¼ÆËã˳Ðò¡£ </simpara> <simpara> Èç¹ûδÔÚ <parameter>string</parameter> ÖÐÕÒµ½Æ¥ÅäÏÔò <parameter>string</parameter> ½«Ô­Ñù·µ»Ø¡£ </simpara> <para> ÀýÈ磬ÏÂÃæµÄ´úÂëÆ¬¶ÏÊä³ö "This was a test" Èý´Î£º </para> <para> <example> <title><function>ereg_replace</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ <?php $string = "This is a test"; echo ereg_replace (" is", " was", $string); echo ereg_replace ("( )is", "\\1was", $string); echo ereg_replace ("(( )is)", "\\2was", $string); ?> ]]> </programlisting> </example> </para> <para> ҪעÒâµÄÒ»µãÊÂÈç¹ûÔÚ <parameter>replacement</parameter> ²ÎÊýÖÐʹÓÃÁËÕûÊýÖµ£¬Ôò¿ÉÄܵò»µ½ËùÆÚÍûµÄ½á¹û¡£ÕâÊÇÒòΪ <function>ereg_replace</function> ½«°ÑÊý×Ö×÷Ϊ×Ö·ûµÄÐòÁÐÖµÀ´½âÊͲ¢Ó¦ÓÃÖ®¡£ÀýÈ磺 </para> <para> <example> <title><function>ereg_replace</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ <?php /* ²»ÄܲúÉú³öÆÚÍûµÄ½á¹û */ $num = 4; $string = "This string has four words."; $string = ereg_replace('four', $num, $string); echo $string; /* Output: 'This string has words.' */ /* ±¾Àý¹¤×÷Õý³£ */ $num = '4'; $string = "This string has four words."; $string = ereg_replace('four', $num, $string); echo $string; /* Output: 'This string has 4 words.' */ ?> ]]> </programlisting> </example> </para> <para> <example> <title>½« URL Ìæ»»Îª³¬Á¬½Ó</title> <programlisting role="php"> <![CDATA[ <?php $text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">\\0</a>", $text); ?> ]]> </programlisting> </example> </para> <tip> <para> <function>preg_replace</function> º¯ÊýʹÓÃÁË Perl ¼æÈÝÕýÔò±í´ïʽÓï·¨£¬Í¨³£ÊÇ±È <function>ereg_replace</function> ¸ü¿ìµÄÌæ´ú·½°¸¡£ </para> </tip> <para> ²Î¼û <function>ereg</function>£¬<function>eregi</function>£¬<function>eregi_replace</function>£¬<function>str_replace</function> ºÍ <function>preg_match</function>¡£ </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/regex/functions/eregi-replace.xml +++ phpdoc-zh/reference/regex/functions/eregi-replace.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> <refentry id="function.eregi-replace"> <refnamediv> <refname>eregi_replace</refname> <refpurpose>²»Çø·Ö´óÐ¡Ð´Ìæ»»ÕýÔò±í´ïʽ</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>string</type><methodname>eregi_replace</methodname> <methodparam><type>string</type><parameter>pattern</parameter></methodparam> <methodparam><type>string</type><parameter>replacement</parameter></methodparam> <methodparam><type>string</type><parameter>string</parameter></methodparam> </methodsynopsis> <para> ±¾º¯ÊýºÍ <function>ereg_replace</function> ÍêÈ«Ïàͬ£¬Ö»³ýÁËÔÚÆ¥Åä×Öĸ×Ö·ûʱºöÂÔ´óСдµÄÇø±ð¡£ </para> <para> ²Î¼û <function>ereg</function>£¬<function>eregi</function> ºÍ <function>ereg_replace</function>¡£ </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/regex/functions/split.xml +++ phpdoc-zh/reference/regex/functions/split.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> <refentry id="function.split"> <refnamediv> <refname>split</refname> <refpurpose>ÓÃÕýÔò±í´ïʽ½«×Ö·û´®·Ö¸îµ½Êý×éÖÐ</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>array</type><methodname>split</methodname> <methodparam><type>string</type><parameter>pattern</parameter></methodparam> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>limit</parameter></methodparam> </methodsynopsis> <tip> <para> <function>preg_split</function> º¯ÊýʹÓÃÁË Perl ¼æÈÝÕýÔò±í´ïʽÓï·¨£¬Í¨³£ÊÇ±È <function>split</function> ¸ü¿ìµÄÌæ´ú·½°¸¡£Èç¹û²»ÐèÒªÕýÔò±í´ïʽµÄÍþÁ¦£¬ÔòʹÓà <function>explode</function> ¸ü¿ì£¬ÕâÑù¾Í²»»áÕÐÖÂÕýÔò±í´ïʽÒýÇæµÄÀË·Ñ¡£ </para> </tip> <para> ±¾º¯Êý·µ»ØÒ»¸ö×Ö·û´®Êý×飬ÿ¸öµ¥ÔªÎª <parameter>string</parameter> ¾­Çø·Ö´óСдµÄÕýÔò±í´ïʽ <parameter>pattern</parameter> ×÷Ϊ±ß½ç·Ö¸î³öµÄ×Ó´®¡£Èç¹ûÉ趨ÁË <parameter>limit</parameter>£¬Ôò·µ»ØµÄÊý×é×î¶à°üº¬ <parameter>limit</parameter> ¸öµ¥Ôª£¬¶øÆäÖÐ×îºóÒ»¸öµ¥Ôª°üº¬ÁË <parameter>string</parameter> ÖÐÊ£ÓàµÄËùÓв¿·Ö¡£Èç¹û³ö´í£¬Ôò <function>split</function> ·µ»Ø &false;¡£ </para> <para> ½« <filename>/etc/passwd</filename> ÖеÄǰËĸö×ֶηָî³öÀ´£º </para> <para> <example> <title><function>split</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ <?php list($user, $pass, $uid, $gid, $extra) = split (":", $passwd_line, 5); ?> ]]> </programlisting> </example> </para> <simpara> Èç¹û×Ö·û´®ÖÐÓÐ <replaceable>n</replaceable> ¸öÓë <parameter>pattern</parameter> Æ¥ÅäµÄÏîÄ¿£¬Ôò·µ»ØµÄÊý×齫°üº¬ <literal><replaceable>n</replaceable>+1</literal> ¸öµ¥Ôª¡£ÀýÈ磬Èç¹ûûÓÐÕÒµ½ <parameter>pattern</parameter>£¬Ôò»á·µ»ØÒ»¸öÖ»ÓÐÒ»¸öµ¥ÔªµÄÊý×é¡£µ±È»£¬Èç¹û <parameter>string</parameter> Ϊ¿ÕÒ²ÊÇÕâÑù¡£ </simpara> <para> ½âÎö¿ÉÄÜÓÃбÏߣ¬µã£¬»òºáÏß·Ö¸îµÄÈÕÆÚ£º </para> <para> <example> <title><function>split</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ <?php // ·Ö¸ô·û¿ÉÒÔÊÇбÏߣ¬µã£¬»òºáÏß $date = "04/30/1973"; list($month, $day, $year) = split ('[/.-]', $date); echo "Month: $month; Day: $day; Year: $year<br />\n"; ?> ]]> </programlisting> </example> </para> <para> Ïë·ÂЧ Perl ÖÐÀàËÆµÄ <command>@chars = split('', $str)</command> ÐÐΪ£¬Çë²Î¿¼ <function>preg_split</function> º¯ÊýÖеÄÀý×Ó¡£ </para> <para> ×¢Òâ <parameter>pattern</parameter> ÊÇÒ»¸öÕýÔò±í´ïʽ¡£Èç¹ûÏëÒªÓõķָî×Ö·ûÊÇÕýÔò±í´ïʽÖеÄÌØÊâ×Ö·û£¬ÒªÏȽ«ÆäתÒå¡£Èç¹û¾õµÃ <function>split</function>£¨»òÆäËüÈκΠregex º¯Êý£©ÐÐΪ¹Å¹ÖµÄ»°£¬ÇëÔĶÁ°üº¬ÔÚ PHP ·¢ÐаüÖÐ <filename>regex/</filename> ×ÓĿ¼Ï嵀 <filename>regex.7</filename> Îļþ¡£¸ÃÎļþÊÇÊÖ²áÒ³Ãæ¸ñʽ£¬¿ÉÒÔÓÃÀàËÆ <command>man /usr/local/src/regex/regex.7</command> µÄÃüÁîÀ´ÔĶÁ¡£ </para> <para> ²Î¼û <function>preg_split</function>£¬<function>spliti</function>£¬<function>explode</function>£¬<function>implode</function>£¬<function>chunk_split</function> ºÍ <function>wordwrap</function>¡£ </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: phpdoc-zh/reference/regex/functions/sql-regcase.xml +++ phpdoc-zh/reference/regex/functions/sql-regcase.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.sql-regcase"> <refnamediv> <refname>sql_regcase</refname> <refpurpose> ²úÉúÓÃÓÚ²»Çø·Ö´óСµÄÆ¥ÅäµÄÕýÔò±í´ïʽ </refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>string</type><methodname>sql_regcase</methodname> <methodparam><type>string</type><parameter>string</parameter></methodparam> </methodsynopsis> <para> ·µ»ØÓë <parameter>string</parameter> ÏàÆ¥ÅäµÄÕýÔò±í´ïʽ£¬²»ÂÛ´óСд×Öĸ¡£·µ»ØµÄ±í´ïʽÊǽ« <parameter>string</parameter> ÖеÄÿ¸ö×Öĸ×Ö·ûת»»Îª·½À¨ºÅ±í´ïʽ£¬¸Ã·½À¨ºÅ±í´ïʽ°üº¬Á˸Ã×ÖĸµÄ´óСдÐÎʽ¡£ÆäËü×Ö·û±£Áô²»±ä¡£ </para> <para> <example> <title><function>sql_regcase</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ <?php echo sql_regcase ("Foo - bar."); ?> ]]> </programlisting> <para> Êä³öΪ£º </para> <screen>[Ff][Oo][Oo] - [Bb][Aa][Rr].</screen> </example> </para> <para> ¿ÉÒÔÓÃÓÚÔÚ½öÖ§³ÖÇø·Ö´óСдÕýÔò±í´ïʽµÄ²úÆ·ÖÐÍê³É²»Çø·Ö´óСдµÄģʽƥÅä¡£ </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
« previous php.doc.zh (#1753) next »