CVS update: phpdoc/functions
| From: | jim | Date: | Sun, 20 Jun 1999 01:21:17 +0000 |
| Subject: | CVS update: phpdoc/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-7169@lists.php.net to get a copy of this message | ||
Date: Saturday June 19, 1999 @ 21:21
Author: jim
Update of /repository/phpdoc/functions
In directory php:/tmp/cvs-serv6699/functions
Modified Files:
regex.sgml
Log Message:
More reorganization. Big change here is breaking up the features section
into a number of smaller chapters, and chopping the "Language Reference"
part into a three parts ("Getting Started", "Language Reference", and
the badly-named "Features").
Index: phpdoc/functions/regex.sgml
diff -u phpdoc/functions/regex.sgml:1.1.1.1 phpdoc/functions/regex.sgml:1.2
--- phpdoc/functions/regex.sgml:1.1.1.1 Sun Jun 6 14:50:55 1999
+++ phpdoc/functions/regex.sgml Sat Jun 19 21:21:16 1999
@@ -2,6 +2,75 @@
<reference id="ref.regex">
<title>Regular expression functions</title>
<titleabbrev>Regexps</titleabbrev>
+ <partintro>
+ <para>
+ Regular expressions are used for complex string manipulation in
+ PHP. The functions that support regular expressions are:
+
+ <itemizedlist>
+ <listitem>
+ <simpara><function>ereg</function>
+ </listitem>
+ <listitem>
+ <simpara><function>ereg_replace</function>
+ </listitem>
+ <listitem>
+ <simpara><function>eregi</function>
+ </listitem>
+ <listitem>
+ <simpara><function>eregi_replace</function>
+ </listitem>
+ <listitem>
+ <simpara><function>split</function>
+ </listitem>
+ </itemizedlist>
+
+ 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
+ regular expressions see the regex man pages included in the regex
+ directory in the PHP distribution.
+
+ <!-- Should add discussion of PCRE functions here. -->
+
+ <para>
+ <example>
+ <title>Regular expression examples</title>
+ <programlisting>
+ereg("abc",$string);
+/* Returns true if "abc"
+ is found anywhere in $string. */
+
+ereg("^abc",$string);
+/* Returns true if "abc"
+ is found at the beginning of $string. */
+
+ereg("abc$",$string);
+/* Returns true if "abc"
+ is found at the end of $string. */
+
+eregi("(ozilla.[23]|MSIE.3)",$HTTP_USER_AGENT);
+/* Returns true if client browser
+ is Netscape 2, 3 or MSIE 3. */
+
+ereg("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)",
+ $string,$regs);
+/* Places three space separated words
+ into $regs[1], $regs[2] and $regs[3]. */
+
+ereg_replace("^","<BR>",$string);
+/* Put a <BR> tag at the beginning of $string. */
+
+ereg_replace("$","<BR>",$string);
+/* Put a <BR> tag at the end of $string. */
+
+ereg_replace("\n","",$string);
+/* Get rid of any carriage return
+ characters in $string. */
+ </programlisting>
+ </example>
+
+ </partintro>
<refentry id="function.ereg">
<refnamediv>