cvs: phpdoc /en/reference/regex configure.xml reference.xml /en/reference/regex/functions ereg-replace.xml ereg.xml eregi-replace.xml eregi.xml
split.xml spliti.xml sql-regcase.xml
| From: | Derick Rethans | Date: | Fri, 20 Jun 2003 21:31:15 +0000 |
| Subject: | cvs: phpdoc /en/reference/regex configure.xml reference.xml /en/reference/regex/functions ereg-replace.xml ereg.xml eregi-replace.xml eregi.xml split.xml spliti.xml sql-regcase.xml |
||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969354715@lists.php.net to get a copy of this message | ||
derick Fri Jun 20 17:31:15 2003 EDT
Modified files:
/phpdoc/en/reference/regex configure.xml reference.xml
/phpdoc/en/reference/regex/functions ereg-replace.xml ereg.xml
eregi-replace.xml eregi.xml
split.xml spliti.xml
sql-regcase.xml
Log:
- Cleanup
Index: phpdoc/en/reference/regex/configure.xml diff -u phpdoc/en/reference/regex/configure.xml:1.2 phpdoc/en/reference/regex/configure.xml:1.3 --- phpdoc/en/reference/regex/configure.xml:1.2 Tue Jan 7 15:21:38 2003 +++ phpdoc/en/reference/regex/configure.xml Fri Jun 20 17:31:15 2003 @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <section id="regex.installation"> &reftitle.install; + <warning> + <simpara> + Do not change the TYPE unless you know what you are doing. + </simpara> + </warning> <para> To enable regexp support configure PHP <option role="configure">--with-regex[=TYPE]</option>. TYPE can be one of system, apache, php. The default is to use php. </para> - <note> - <simpara> - Do not change the TYPE unless you know what you are doing. - </simpara> - </note> &windows.builtin; </section> Index: phpdoc/en/reference/regex/reference.xml diff -u phpdoc/en/reference/regex/reference.xml:1.7 phpdoc/en/reference/regex/reference.xml:1.8 --- phpdoc/en/reference/regex/reference.xml:1.7 Thu Apr 17 08:17:50 2003 +++ phpdoc/en/reference/regex/reference.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <reference id="ref.regex"> <title>Regular Expression Functions (POSIX Extended)</title> <titleabbrev>Regexps</titleabbrev> @@ -7,7 +7,7 @@ <partintro> <section id="regex.intro"> &reftitle.intro; - <note> + <tip> <para> PHP also supports regular expressions using a Perl-compatible syntax using the <link linkend="ref.pcre">PCRE functions</link>. Those functions @@ -15,7 +15,7 @@ number of other features not supported by the POSIX-extended regular expression syntax. </para> - </note> + </tip> <warning> <para> These regular expression functions are not binary-safe. The <link @@ -45,6 +45,8 @@ <simpara><function>spliti</function></simpara> </listitem> </itemizedlist> + </para> + <para> These functions all take a regular expression string as their first argument. PHP uses the POSIX extended regular expressions as defined by POSIX 1003.2. For a full description of POSIX @@ -84,35 +86,31 @@ <title>Regular Expression Examples</title> <programlisting role="php"> <![CDATA[ +<?php +// Returns true if "abc" is found anywhere in $string. ereg ("abc", $string); -/* Returns true if "abc" - is found anywhere in $string. */ +// Returns true if "abc" is found at the beginning of $string. ereg ("^abc", $string); -/* Returns true if "abc" - is found at the beginning of $string. */ +// Returns true if "abc" is found at the end of $string. ereg ("abc$", $string); -/* Returns true if "abc" - is found at the end of $string. */ +// Returns true if client browser is Netscape 2, 3 or MSIE 3. eregi ("(ozilla.[23]|MSIE.3)", $HTTP_USER_AGENT); -/* Returns true if client browser - is Netscape 2, 3 or MSIE 3. */ +// Places three space separated words into $regs[1], $regs[2] and $regs[3]. ereg ("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)", $string,$regs); -/* Places three space separated words - into $regs[1], $regs[2] and $regs[3]. */ +// Put a <br /> tag at the beginning of $string. $string = ereg_replace ("^", "<br />", $string); -/* Put a <br /> tag at the beginning of $string. */ +// Put a <br /> tag at the end of $string. $string = ereg_replace ("$", "<br />", $string); -/* Put a <br /> tag at the end of $string. */ +// Get rid of any newline characters in $string. $string = ereg_replace ("\n", "", $string); -/* Get rid of any newline - characters in $string. */ +?> ]]> </programlisting> </example> @@ -129,7 +127,7 @@ </section> </partintro> -&reference.regex.functions; + &reference.regex.functions; </reference> <!-- Keep this comment at the end of the file Index: phpdoc/en/reference/regex/functions/ereg-replace.xml diff -u phpdoc/en/reference/regex/functions/ereg-replace.xml:1.3 phpdoc/en/reference/regex/functions/ereg-replace.xml:1.4 --- phpdoc/en/reference/regex/functions/ereg-replace.xml:1.3 Fri Feb 28 18:49:59 2003 +++ phpdoc/en/reference/regex/functions/ereg-replace.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.ereg-replace"> <refnamediv> @@ -8,19 +8,12 @@ </refnamediv> <refsect1> <title>Description</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> - <note> - <para> - <function>preg_replace</function>, which uses a Perl-compatible - regular expression syntax, is often a faster alternative to - <function>ereg_replace</function>. - </para> - </note> + <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> This function scans <parameter>string</parameter> for matches to <parameter>pattern</parameter>, then replaces the matched text @@ -49,8 +42,10 @@ <para> For example, the following code snippet prints "This was a test" three times: + </para> + <para> <example> - <title><function>ereg_replace</function> Example</title> + <title><function>ereg_replace</function> example</title> <programlisting> <![CDATA[ $string = "This is a test"; @@ -67,8 +62,10 @@ the results you expect. This is because <function>ereg_replace</function> will interpret the number as the ordinal value of a character, and apply that. For instance: + </para> + <para> <example> - <title><function>ereg_replace</function> Example</title> + <title><function>ereg_replace</function> example</title> <programlisting> <![CDATA[ <?php @@ -93,23 +90,28 @@ <title>Replace URLs with links</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>, which uses a Perl-compatible + regular expression syntax, is often a faster alternative to + <function>ereg_replace</function>. + </para> + </tip> <para> - See also - <function>ereg</function>, - <function>eregi</function>, - <function>eregi_replace</function>, - <function>str_replace</function>, and + See also <function>ereg</function>, <function>eregi</function>, + <function>eregi_replace</function>, <function>str_replace</function>, and <function>preg_match</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/ereg.xml diff -u phpdoc/en/reference/regex/functions/ereg.xml:1.4 phpdoc/en/reference/regex/functions/ereg.xml:1.5 --- phpdoc/en/reference/regex/functions/ereg.xml:1.4 Fri Feb 28 18:49:59 2003 +++ phpdoc/en/reference/regex/functions/ereg.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.ereg"> <refnamediv> @@ -8,12 +8,12 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>ereg</methodname> - <methodparam><type>string</type><parameter>pattern</parameter></methodparam> - <methodparam><type>string</type><parameter>string</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>bool</type><methodname>ereg</methodname> + <methodparam><type>string</type><parameter>pattern</parameter></methodparam> + <methodparam><type>string</type><parameter>string</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam> + </methodsynopsis> <note> <para> <function>preg_match</function>, which uses a Perl-compatible @@ -23,7 +23,8 @@ </note> <simpara> Searches a <parameter>string</parameter> for matches to the regular - expression given in <parameter>pattern</parameter>. + expression given in <parameter>pattern</parameter> in a case-sensitive + way. </simpara> <simpara> If matches are found for parenthesized substrings of @@ -36,19 +37,16 @@ contain a copy of the complete string matched. </simpara> <note> - <simpara> - Up to (and including) PHP 4.1.0 <literal>$regs</literal> will be - filled with exactly ten elements, even though more or fewer than - ten parenthesized substrings may actually have matched. This has - no effect on <function>ereg</function>'s ability to match more - substrings. If no matches are found, <literal>$regs</literal> - will not be altered by <function>ereg</function>. - </simpara> + <simpara> + Up to (and including) PHP 4.1.0 <varname>$regs</varname> will be + filled with exactly ten elements, even though more or fewer than + ten parenthesized substrings may actually have matched. This has + no effect on <function>ereg</function>'s ability to match more + substrings. If no matches are found, <literal>$regs</literal> + will not be altered by <function>ereg</function>. + </simpara> </note> <simpara> - Searching is case sensitive. - </simpara> - <simpara> Returns &true; if a match for <parameter>pattern</parameter> was found in <parameter>string</parameter>, or &false; if no matches were found or an error occurred. @@ -56,6 +54,8 @@ <para> The following code snippet takes a date in ISO format (YYYY-MM-DD) and prints it in DD.MM.YYYY format: + </para> + <para> <example> <title><function>ereg</function> example</title> <programlisting role="php"> @@ -72,17 +72,12 @@ </example> </para> <para> - See also - <function>eregi</function>, - <function>ereg_replace</function>, - <function>eregi_replace</function>, - <function>preg_match</function>, - <function>strpos</function>, and - <function>strstr</function>. + See also <function>eregi</function>, <function>ereg_replace</function>, + <function>eregi_replace</function>, <function>preg_match</function>, + <function>strpos</function>, and <function>strstr</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/eregi-replace.xml diff -u phpdoc/en/reference/regex/functions/eregi-replace.xml:1.2 phpdoc/en/reference/regex/functions/eregi-replace.xml:1.3 --- phpdoc/en/reference/regex/functions/eregi-replace.xml:1.2 Wed Apr 17 02:43:50 2002 +++ phpdoc/en/reference/regex/functions/eregi-replace.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.eregi-replace"> <refnamediv> @@ -8,12 +8,12 @@ </refnamediv> <refsect1> <title>Description</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> + <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> This function is identical to <function>ereg_replace</function> except that this ignores case distinction when matching @@ -25,7 +25,6 @@ </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/eregi.xml diff -u phpdoc/en/reference/regex/functions/eregi.xml:1.3 phpdoc/en/reference/regex/functions/eregi.xml:1.4 --- phpdoc/en/reference/regex/functions/eregi.xml:1.3 Thu Feb 20 04:47:21 2003 +++ phpdoc/en/reference/regex/functions/eregi.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.eregi"> <refnamediv> @@ -8,16 +8,18 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>eregi</methodname> - <methodparam><type>string</type><parameter>pattern</parameter></methodparam> - <methodparam><type>string</type><parameter>string</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>bool</type><methodname>eregi</methodname> + <methodparam><type>string</type><parameter>pattern</parameter></methodparam> + <methodparam><type>string</type><parameter>string</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam> + </methodsynopsis> <para> This function is identical to <function>ereg</function> except that this ignores case distinction when matching alphabetic characters. + </para> + <para> <example> <title><function>eregi</function> example</title> <programlisting role="php"> @@ -32,15 +34,12 @@ </example> </para> <para> - See also <function>ereg</function>, - <function>ereg_replace</function>, - <function>eregi_replace</function>, - <function>stripos</function>, and + See also <function>ereg</function>, <function>ereg_replace</function>, + <function>eregi_replace</function>, <function>stripos</function>, and <function>stristr</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/split.xml diff -u phpdoc/en/reference/regex/functions/split.xml:1.2 phpdoc/en/reference/regex/functions/split.xml:1.3 --- phpdoc/en/reference/regex/functions/split.xml:1.2 Wed Apr 17 02:43:51 2002 +++ phpdoc/en/reference/regex/functions/split.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.7 --> <refentry id="function.split"> <refnamediv> @@ -8,23 +8,25 @@ </refnamediv> <refsect1> <title>Description</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> - <note> + <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>, which uses a Perl-compatible - regular expression syntax, is often a faster alternative to - <function>split</function>. + <function>preg_split</function>, which uses a Perl-compatible regular + expression syntax, is often a faster alternative to + <function>split</function>. If you don't require the power of regular + expressions, it is faster to use <function>explode</function>, which + doesn't incur the overhead of the regular expression engine. </para> - </note> + </tip> <para> Returns an array of strings, each of which is a substring of <parameter>string</parameter> formed by splitting it on - boundaries formed by the regular expression + boundaries formed by the case-sensitive regular expression <parameter>pattern</parameter>. If <parameter>limit</parameter> is set, the returned array will contain a maximum of <parameter>limit</parameter> elements with the last element @@ -34,53 +36,51 @@ <para> To split off the first four fields from a line from <filename>/etc/passwd</filename>: + </para> + <para> <example> - <title><function>split</function> Example</title> + <title><function>split</function> example</title> <programlisting role="php"> <![CDATA[ -list($user,$pass,$uid,$gid,$extra)= split (":", $passwd_line, 5); +<?php +list($user, $pass, $uid, $gid, $extra) = + split (":", $passwd_line, 5); +?> ]]> </programlisting> </example> </para> - <note> - <simpara> - If there are <replaceable>n</replaceable> occurrences of - <parameter>pattern</parameter>, the returned array will contain - <literal><replaceable>n</replaceable>+1</literal> items. For example, if - there is no occurrence of <parameter>pattern</parameter>, an array with - only one element will be returned. Of course, this is also true if - <parameter>string</parameter> is empty. - </simpara> - </note> + <simpara> + If there are <replaceable>n</replaceable> occurrences of + <parameter>pattern</parameter>, the returned array will contain + <literal><replaceable>n</replaceable>+1</literal> items. For example, if + there is no occurrence of <parameter>pattern</parameter>, an array with + only one element will be returned. Of course, this is also true if + <parameter>string</parameter> is empty. + </simpara> <para> To parse a date which may be delimited with slashes, dots, or hyphens: + </para> + <para> <example> - <title><function>split</function> Example</title> + <title><function>split</function> example</title> <programlisting role="php"> <![CDATA[ -$date = "04/30/1973"; // Delimiters may be slash, dot, or hyphen -list ($month, $day, $year) = split ('[/.-]', $date); -echo "Month: $month; Day: $day; Year: $year<br>\n"; +<?php +// Delimiters may be slash, dot, or hyphen +$date = "04/30/1973"; +list($month, $day, $year) = split ('[/.-]', $date); +echo "Month: $month; Day: $day; Year: $year<br />\n"; +?> ]]> </programlisting> </example> </para> <para> - Note that <parameter>pattern</parameter> is case-sensitive. - </para> - - <para> - Note that if you don't require the power of regular expressions, - it is faster to use <function>explode</function>, which doesn't - incur the overhead of the regular expression engine. - </para> - - <para> For users looking for a way to emulate Perl's <command>@chars = - split('', $str)</command> behaviour, please see the examples for + split('', $str)</command> behaviour, please see the examples for <function>preg_split</function>. </para> @@ -98,18 +98,13 @@ </para> <para> - See also: - <function>preg_split</function>, - <function>spliti</function>, - <function>explode</function>, - <function>implode</function>, - <function>chunk_split</function>, and - <function>wordwrap</function>. + See also: <function>preg_split</function>, <function>spliti</function>, + <function>explode</function>, <function>implode</function>, + <function>chunk_split</function>, and <function>wordwrap</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/spliti.xml diff -u phpdoc/en/reference/regex/functions/spliti.xml:1.2 phpdoc/en/reference/regex/functions/spliti.xml:1.3 --- phpdoc/en/reference/regex/functions/spliti.xml:1.2 Wed Apr 17 02:43:51 2002 +++ phpdoc/en/reference/regex/functions/spliti.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.spliti"> <refnamediv> @@ -10,27 +10,23 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>spliti</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> + <methodsynopsis> + <type>array</type><methodname>spliti</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> <para> This function is identical to <function>split</function> except that this ignores case distinction when matching alphabetic characters. </para> <para> - See also - <function>preg_spliti</function>, - <function>split</function>, - <function>explode</function>, - and <function>implode</function>. + See also <function>preg_spliti</function>, <function>split</function>, + <function>explode</function>, and <function>implode</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/sql-regcase.xml diff -u phpdoc/en/reference/regex/functions/sql-regcase.xml:1.2 phpdoc/en/reference/regex/functions/sql-regcase.xml:1.3 --- phpdoc/en/reference/regex/functions/sql-regcase.xml:1.2 Wed Apr 17 02:43:51 2002 +++ phpdoc/en/reference/regex/functions/sql-regcase.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.sql-regcase"> <refnamediv> @@ -21,15 +21,22 @@ bracket expression; this bracket expression contains that character's uppercase and lowercase form if applicable, otherwise it contains the original character twice. + </para> + <para> <example> - <title><function>sql_regcase</function> Example</title> + <title><function>sql_regcase</function> example</title> <programlisting role="php"> <![CDATA[ +<?php echo sql_regcase ("Foo bar"); +?> ]]> </programlisting> + <para> + prints: + </para> + <screen>[Ff][Oo][Oo] [Bb][Aa][Rr]</screen> </example> - prints <screen>[Ff][Oo][Oo] [Bb][Aa][Rr]</screen>. </para> <para> This can be used to achieve case insensitive pattern matching in @@ -37,7 +44,6 @@ </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml
Index: phpdoc/en/reference/regex/configure.xml diff -u phpdoc/en/reference/regex/configure.xml:1.2 phpdoc/en/reference/regex/configure.xml:1.3 --- phpdoc/en/reference/regex/configure.xml:1.2 Tue Jan 7 15:21:38 2003 +++ phpdoc/en/reference/regex/configure.xml Fri Jun 20 17:31:15 2003 @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <section id="regex.installation"> &reftitle.install; + <warning> + <simpara> + Do not change the TYPE unless you know what you are doing. + </simpara> + </warning> <para> To enable regexp support configure PHP <option role="configure">--with-regex[=TYPE]</option>. TYPE can be one of system, apache, php. The default is to use php. </para> - <note> - <simpara> - Do not change the TYPE unless you know what you are doing. - </simpara> - </note> &windows.builtin; </section> Index: phpdoc/en/reference/regex/reference.xml diff -u phpdoc/en/reference/regex/reference.xml:1.7 phpdoc/en/reference/regex/reference.xml:1.8 --- phpdoc/en/reference/regex/reference.xml:1.7 Thu Apr 17 08:17:50 2003 +++ phpdoc/en/reference/regex/reference.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <reference id="ref.regex"> <title>Regular Expression Functions (POSIX Extended)</title> <titleabbrev>Regexps</titleabbrev> @@ -7,7 +7,7 @@ <partintro> <section id="regex.intro"> &reftitle.intro; - <note> + <tip> <para> PHP also supports regular expressions using a Perl-compatible syntax using the <link linkend="ref.pcre">PCRE functions</link>. Those functions @@ -15,7 +15,7 @@ number of other features not supported by the POSIX-extended regular expression syntax. </para> - </note> + </tip> <warning> <para> These regular expression functions are not binary-safe. The <link @@ -45,6 +45,8 @@ <simpara><function>spliti</function></simpara> </listitem> </itemizedlist> + </para> + <para> These functions all take a regular expression string as their first argument. PHP uses the POSIX extended regular expressions as defined by POSIX 1003.2. For a full description of POSIX @@ -84,35 +86,31 @@ <title>Regular Expression Examples</title> <programlisting role="php"> <![CDATA[ +<?php +// Returns true if "abc" is found anywhere in $string. ereg ("abc", $string); -/* Returns true if "abc" - is found anywhere in $string. */ +// Returns true if "abc" is found at the beginning of $string. ereg ("^abc", $string); -/* Returns true if "abc" - is found at the beginning of $string. */ +// Returns true if "abc" is found at the end of $string. ereg ("abc$", $string); -/* Returns true if "abc" - is found at the end of $string. */ +// Returns true if client browser is Netscape 2, 3 or MSIE 3. eregi ("(ozilla.[23]|MSIE.3)", $HTTP_USER_AGENT); -/* Returns true if client browser - is Netscape 2, 3 or MSIE 3. */ +// Places three space separated words into $regs[1], $regs[2] and $regs[3]. ereg ("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)", $string,$regs); -/* Places three space separated words - into $regs[1], $regs[2] and $regs[3]. */ +// Put a <br /> tag at the beginning of $string. $string = ereg_replace ("^", "<br />", $string); -/* Put a <br /> tag at the beginning of $string. */ +// Put a <br /> tag at the end of $string. $string = ereg_replace ("$", "<br />", $string); -/* Put a <br /> tag at the end of $string. */ +// Get rid of any newline characters in $string. $string = ereg_replace ("\n", "", $string); -/* Get rid of any newline - characters in $string. */ +?> ]]> </programlisting> </example> @@ -129,7 +127,7 @@ </section> </partintro> -&reference.regex.functions; + &reference.regex.functions; </reference> <!-- Keep this comment at the end of the file Index: phpdoc/en/reference/regex/functions/ereg-replace.xml diff -u phpdoc/en/reference/regex/functions/ereg-replace.xml:1.3 phpdoc/en/reference/regex/functions/ereg-replace.xml:1.4 --- phpdoc/en/reference/regex/functions/ereg-replace.xml:1.3 Fri Feb 28 18:49:59 2003 +++ phpdoc/en/reference/regex/functions/ereg-replace.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.ereg-replace"> <refnamediv> @@ -8,19 +8,12 @@ </refnamediv> <refsect1> <title>Description</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> - <note> - <para> - <function>preg_replace</function>, which uses a Perl-compatible - regular expression syntax, is often a faster alternative to - <function>ereg_replace</function>. - </para> - </note> + <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> This function scans <parameter>string</parameter> for matches to <parameter>pattern</parameter>, then replaces the matched text @@ -49,8 +42,10 @@ <para> For example, the following code snippet prints "This was a test" three times: + </para> + <para> <example> - <title><function>ereg_replace</function> Example</title> + <title><function>ereg_replace</function> example</title> <programlisting> <![CDATA[ $string = "This is a test"; @@ -67,8 +62,10 @@ the results you expect. This is because <function>ereg_replace</function> will interpret the number as the ordinal value of a character, and apply that. For instance: + </para> + <para> <example> - <title><function>ereg_replace</function> Example</title> + <title><function>ereg_replace</function> example</title> <programlisting> <![CDATA[ <?php @@ -93,23 +90,28 @@ <title>Replace URLs with links</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>, which uses a Perl-compatible + regular expression syntax, is often a faster alternative to + <function>ereg_replace</function>. + </para> + </tip> <para> - See also - <function>ereg</function>, - <function>eregi</function>, - <function>eregi_replace</function>, - <function>str_replace</function>, and + See also <function>ereg</function>, <function>eregi</function>, + <function>eregi_replace</function>, <function>str_replace</function>, and <function>preg_match</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/ereg.xml diff -u phpdoc/en/reference/regex/functions/ereg.xml:1.4 phpdoc/en/reference/regex/functions/ereg.xml:1.5 --- phpdoc/en/reference/regex/functions/ereg.xml:1.4 Fri Feb 28 18:49:59 2003 +++ phpdoc/en/reference/regex/functions/ereg.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.ereg"> <refnamediv> @@ -8,12 +8,12 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>ereg</methodname> - <methodparam><type>string</type><parameter>pattern</parameter></methodparam> - <methodparam><type>string</type><parameter>string</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>bool</type><methodname>ereg</methodname> + <methodparam><type>string</type><parameter>pattern</parameter></methodparam> + <methodparam><type>string</type><parameter>string</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam> + </methodsynopsis> <note> <para> <function>preg_match</function>, which uses a Perl-compatible @@ -23,7 +23,8 @@ </note> <simpara> Searches a <parameter>string</parameter> for matches to the regular - expression given in <parameter>pattern</parameter>. + expression given in <parameter>pattern</parameter> in a case-sensitive + way. </simpara> <simpara> If matches are found for parenthesized substrings of @@ -36,19 +37,16 @@ contain a copy of the complete string matched. </simpara> <note> - <simpara> - Up to (and including) PHP 4.1.0 <literal>$regs</literal> will be - filled with exactly ten elements, even though more or fewer than - ten parenthesized substrings may actually have matched. This has - no effect on <function>ereg</function>'s ability to match more - substrings. If no matches are found, <literal>$regs</literal> - will not be altered by <function>ereg</function>. - </simpara> + <simpara> + Up to (and including) PHP 4.1.0 <varname>$regs</varname> will be + filled with exactly ten elements, even though more or fewer than + ten parenthesized substrings may actually have matched. This has + no effect on <function>ereg</function>'s ability to match more + substrings. If no matches are found, <literal>$regs</literal> + will not be altered by <function>ereg</function>. + </simpara> </note> <simpara> - Searching is case sensitive. - </simpara> - <simpara> Returns &true; if a match for <parameter>pattern</parameter> was found in <parameter>string</parameter>, or &false; if no matches were found or an error occurred. @@ -56,6 +54,8 @@ <para> The following code snippet takes a date in ISO format (YYYY-MM-DD) and prints it in DD.MM.YYYY format: + </para> + <para> <example> <title><function>ereg</function> example</title> <programlisting role="php"> @@ -72,17 +72,12 @@ </example> </para> <para> - See also - <function>eregi</function>, - <function>ereg_replace</function>, - <function>eregi_replace</function>, - <function>preg_match</function>, - <function>strpos</function>, and - <function>strstr</function>. + See also <function>eregi</function>, <function>ereg_replace</function>, + <function>eregi_replace</function>, <function>preg_match</function>, + <function>strpos</function>, and <function>strstr</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/eregi-replace.xml diff -u phpdoc/en/reference/regex/functions/eregi-replace.xml:1.2 phpdoc/en/reference/regex/functions/eregi-replace.xml:1.3 --- phpdoc/en/reference/regex/functions/eregi-replace.xml:1.2 Wed Apr 17 02:43:50 2002 +++ phpdoc/en/reference/regex/functions/eregi-replace.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.eregi-replace"> <refnamediv> @@ -8,12 +8,12 @@ </refnamediv> <refsect1> <title>Description</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> + <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> This function is identical to <function>ereg_replace</function> except that this ignores case distinction when matching @@ -25,7 +25,6 @@ </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/eregi.xml diff -u phpdoc/en/reference/regex/functions/eregi.xml:1.3 phpdoc/en/reference/regex/functions/eregi.xml:1.4 --- phpdoc/en/reference/regex/functions/eregi.xml:1.3 Thu Feb 20 04:47:21 2003 +++ phpdoc/en/reference/regex/functions/eregi.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.eregi"> <refnamediv> @@ -8,16 +8,18 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>bool</type><methodname>eregi</methodname> - <methodparam><type>string</type><parameter>pattern</parameter></methodparam> - <methodparam><type>string</type><parameter>string</parameter></methodparam> - <methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>bool</type><methodname>eregi</methodname> + <methodparam><type>string</type><parameter>pattern</parameter></methodparam> + <methodparam><type>string</type><parameter>string</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>regs</parameter></methodparam> + </methodsynopsis> <para> This function is identical to <function>ereg</function> except that this ignores case distinction when matching alphabetic characters. + </para> + <para> <example> <title><function>eregi</function> example</title> <programlisting role="php"> @@ -32,15 +34,12 @@ </example> </para> <para> - See also <function>ereg</function>, - <function>ereg_replace</function>, - <function>eregi_replace</function>, - <function>stripos</function>, and + See also <function>ereg</function>, <function>ereg_replace</function>, + <function>eregi_replace</function>, <function>stripos</function>, and <function>stristr</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/split.xml diff -u phpdoc/en/reference/regex/functions/split.xml:1.2 phpdoc/en/reference/regex/functions/split.xml:1.3 --- phpdoc/en/reference/regex/functions/split.xml:1.2 Wed Apr 17 02:43:51 2002 +++ phpdoc/en/reference/regex/functions/split.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.7 --> <refentry id="function.split"> <refnamediv> @@ -8,23 +8,25 @@ </refnamediv> <refsect1> <title>Description</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> - <note> + <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>, which uses a Perl-compatible - regular expression syntax, is often a faster alternative to - <function>split</function>. + <function>preg_split</function>, which uses a Perl-compatible regular + expression syntax, is often a faster alternative to + <function>split</function>. If you don't require the power of regular + expressions, it is faster to use <function>explode</function>, which + doesn't incur the overhead of the regular expression engine. </para> - </note> + </tip> <para> Returns an array of strings, each of which is a substring of <parameter>string</parameter> formed by splitting it on - boundaries formed by the regular expression + boundaries formed by the case-sensitive regular expression <parameter>pattern</parameter>. If <parameter>limit</parameter> is set, the returned array will contain a maximum of <parameter>limit</parameter> elements with the last element @@ -34,53 +36,51 @@ <para> To split off the first four fields from a line from <filename>/etc/passwd</filename>: + </para> + <para> <example> - <title><function>split</function> Example</title> + <title><function>split</function> example</title> <programlisting role="php"> <![CDATA[ -list($user,$pass,$uid,$gid,$extra)= split (":", $passwd_line, 5); +<?php +list($user, $pass, $uid, $gid, $extra) = + split (":", $passwd_line, 5); +?> ]]> </programlisting> </example> </para> - <note> - <simpara> - If there are <replaceable>n</replaceable> occurrences of - <parameter>pattern</parameter>, the returned array will contain - <literal><replaceable>n</replaceable>+1</literal> items. For example, if - there is no occurrence of <parameter>pattern</parameter>, an array with - only one element will be returned. Of course, this is also true if - <parameter>string</parameter> is empty. - </simpara> - </note> + <simpara> + If there are <replaceable>n</replaceable> occurrences of + <parameter>pattern</parameter>, the returned array will contain + <literal><replaceable>n</replaceable>+1</literal> items. For example, if + there is no occurrence of <parameter>pattern</parameter>, an array with + only one element will be returned. Of course, this is also true if + <parameter>string</parameter> is empty. + </simpara> <para> To parse a date which may be delimited with slashes, dots, or hyphens: + </para> + <para> <example> - <title><function>split</function> Example</title> + <title><function>split</function> example</title> <programlisting role="php"> <![CDATA[ -$date = "04/30/1973"; // Delimiters may be slash, dot, or hyphen -list ($month, $day, $year) = split ('[/.-]', $date); -echo "Month: $month; Day: $day; Year: $year<br>\n"; +<?php +// Delimiters may be slash, dot, or hyphen +$date = "04/30/1973"; +list($month, $day, $year) = split ('[/.-]', $date); +echo "Month: $month; Day: $day; Year: $year<br />\n"; +?> ]]> </programlisting> </example> </para> <para> - Note that <parameter>pattern</parameter> is case-sensitive. - </para> - - <para> - Note that if you don't require the power of regular expressions, - it is faster to use <function>explode</function>, which doesn't - incur the overhead of the regular expression engine. - </para> - - <para> For users looking for a way to emulate Perl's <command>@chars = - split('', $str)</command> behaviour, please see the examples for + split('', $str)</command> behaviour, please see the examples for <function>preg_split</function>. </para> @@ -98,18 +98,13 @@ </para> <para> - See also: - <function>preg_split</function>, - <function>spliti</function>, - <function>explode</function>, - <function>implode</function>, - <function>chunk_split</function>, and - <function>wordwrap</function>. + See also: <function>preg_split</function>, <function>spliti</function>, + <function>explode</function>, <function>implode</function>, + <function>chunk_split</function>, and <function>wordwrap</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/spliti.xml diff -u phpdoc/en/reference/regex/functions/spliti.xml:1.2 phpdoc/en/reference/regex/functions/spliti.xml:1.3 --- phpdoc/en/reference/regex/functions/spliti.xml:1.2 Wed Apr 17 02:43:51 2002 +++ phpdoc/en/reference/regex/functions/spliti.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.spliti"> <refnamediv> @@ -10,27 +10,23 @@ </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>array</type><methodname>spliti</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> + <methodsynopsis> + <type>array</type><methodname>spliti</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> <para> This function is identical to <function>split</function> except that this ignores case distinction when matching alphabetic characters. </para> <para> - See also - <function>preg_spliti</function>, - <function>split</function>, - <function>explode</function>, - and <function>implode</function>. + See also <function>preg_spliti</function>, <function>split</function>, + <function>explode</function>, and <function>implode</function>. </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml Index: phpdoc/en/reference/regex/functions/sql-regcase.xml diff -u phpdoc/en/reference/regex/functions/sql-regcase.xml:1.2 phpdoc/en/reference/regex/functions/sql-regcase.xml:1.3 --- phpdoc/en/reference/regex/functions/sql-regcase.xml:1.2 Wed Apr 17 02:43:51 2002 +++ phpdoc/en/reference/regex/functions/sql-regcase.xml Fri Jun 20 17:31:15 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/regex.xml, last change in rev 1.2 --> <refentry id="function.sql-regcase"> <refnamediv> @@ -21,15 +21,22 @@ bracket expression; this bracket expression contains that character's uppercase and lowercase form if applicable, otherwise it contains the original character twice. + </para> + <para> <example> - <title><function>sql_regcase</function> Example</title> + <title><function>sql_regcase</function> example</title> <programlisting role="php"> <![CDATA[ +<?php echo sql_regcase ("Foo bar"); +?> ]]> </programlisting> + <para> + prints: + </para> + <screen>[Ff][Oo][Oo] [Bb][Aa][Rr]</screen> </example> - prints <screen>[Ff][Oo][Oo] [Bb][Aa][Rr]</screen>. </para> <para> This can be used to achieve case insensitive pattern matching in @@ -37,7 +44,6 @@ </para> </refsect1> </refentry> - <!-- Keep this comment at the end of the file Local variables: mode: sgml