Remove POSIX regex docs

This commit is contained in:
George Peter Banyard 2021-04-30 02:01:13 +01:00
parent bca9a9e2d9
commit 8f5f6a52c0
19 changed files with 1 additions and 1582 deletions

View file

@ -136,7 +136,6 @@
<listitem><simpara><xref linkend="book.readline"/></simpara></listitem>
<listitem><simpara><xref linkend="book.recode"/></simpara></listitem>
<listitem><simpara><xref linkend="book.reflection"/></simpara></listitem>
<listitem><simpara><xref linkend="book.regex"/></simpara></listitem>
<listitem><simpara><xref linkend="book.rrd"/></simpara></listitem>
<listitem><simpara><xref linkend="book.scoutapm"/></simpara></listitem>
<listitem><simpara><xref linkend="book.seaslog"/></simpara></listitem>
@ -229,7 +228,6 @@
<listitem><para><xref linkend="book.password"/></para></listitem>
<listitem><para><xref linkend="book.phar"/></para></listitem>
<listitem><para><xref linkend="book.reflection"/></para></listitem>
<listitem><para><xref linkend="book.regex"/></para></listitem>
<listitem><para><xref linkend="book.session"/></para></listitem>
<listitem><para><xref linkend="book.spl"/></para></listitem>
<listitem><para><xref linkend="book.stream"/></para></listitem>

View file

@ -27,7 +27,7 @@
All ereg* functions
</title>
<para>
All <link linkend="book.regex">ereg</link> functions were removed.
All <literal>ereg</literal> functions were removed.
<link linkend="book.pcre">PCRE</link> is a recommended alternative.
</para>
</sect3>

View file

@ -25,10 +25,6 @@
See <link linkend="reference.pcre.pattern.modifiers">Pattern
Modifiers</link>.
</para>
<para>
PHP also supports regular expressions using a POSIX-extended syntax
using the <link linkend="book.regex">POSIX-extended regex functions</link>.
</para>
<note>
<para>
This extension maintains a global per-thread cache of compiled regular

View file

@ -1,130 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<article xml:id="reference.pcre.pattern.posix" xmlns="http://docbook.org/ns/docbook">
<title>Differences from POSIX regex</title>
<para>
The <link linkend="book.regex">POSIX Regex</link> extension
is deprecated. There are a number of differences between POSIX regex and
PCRE regex. This page lists the most notable ones that are necessary to
know when converting to PCRE.
</para>
<para>
<orderedlist>
<listitem>
<simpara>
The PCRE functions require that the pattern is enclosed by <link
linkend="regexp.reference.delimiters">delimiters</link>.
</simpara>
</listitem>
<listitem>
<simpara>
Unlike POSIX, the PCRE extension does not have dedicated functions for
case-insensitive matching. Instead, this is supported using the
<emphasis>i</emphasis> (<literal>PCRE_CASELESS</literal>) <link
linkend="reference.pcre.pattern.modifiers">pattern modifier</link>. Other
pattern modifiers are also available for changing the matching strategy.
</simpara>
</listitem>
<listitem>
<simpara>
The POSIX functions find the longest of the leftmost match, but PCRE
stops on the first valid match. If the string doesn't match at all it
makes no difference, but if it matches it may have dramatic effects on
both the resulting match and the matching speed.
</simpara>
<simpara>
To illustrate this difference, consider the following example from
"Mastering Regular Expressions" by Jeffrey Friedl. Using the pattern
<literal>one(self)?(selfsufficient)?</literal> on the string
<literal>oneselfsufficient</literal> with PCRE will result in matching
<literal>oneself</literal>, but using POSIX the result will be the full
string <literal>oneselfsufficient</literal>. Both (sub)strings match the
original string, but POSIX requires that the longest be the result.
</simpara>
</listitem>
<listitem>
<simpara>
The POSIX definition of a "character class" differs from that of PCRE.
Simple bracket expressions to match a set of explicit characters are
supported in the form of PCRE
<link linkend="regexp.reference.character-classes">character classes</link>
but POSIX collating elements, character classes and character equivalents
are not supported.
</simpara>
<simpara>
Supplying an expression with a character class that both starts and ends
with <literal>:</literal>, <literal>.</literal> or <literal>=</literal>
characters to PCRE is interpreted as an attempt to use one of these
unsupported features and causes a compilation error.
</simpara>
</listitem>
</orderedlist>
</para>
<para>
<table>
<title>Function replacements</title>
<tgroup cols="2">
<thead>
<row>
<entry>POSIX</entry>
<entry>PCRE</entry>
</row>
</thead>
<tbody>
<row>
<entry><function>ereg_replace</function></entry>
<entry><function>preg_replace</function></entry>
</row>
<row>
<entry><function>ereg</function></entry>
<entry><function>preg_match</function></entry>
</row>
<row>
<entry><function>eregi_replace</function></entry>
<entry><function>preg_replace</function></entry>
</row>
<row>
<entry><function>eregi</function></entry>
<entry><function>preg_match</function></entry>
</row>
<row>
<entry><function>split</function></entry>
<entry><function>preg_split</function></entry>
</row>
<row>
<entry><function>spliti</function></entry>
<entry><function>preg_split</function></entry>
</row>
<row>
<entry><function>sql_regcase</function></entry>
<entry><emphasis>No equivalent</emphasis></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</article>
<!-- 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:"~/.phpdoc/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
-->

View file

@ -7,7 +7,6 @@
&reference.pcre.pattern.syntax;
&reference.pcre.pattern.modifiers;
&reference.pcre.pattern.differences;
&reference.pcre.pattern.posix;
</part>
<!-- Keep this comment at the end of the file

View file

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.regex" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<?phpdoc extension-membership="pecl" ?>
<title>Regular Expression (POSIX Extended)</title>
<titleabbrev>POSIX Regex</titleabbrev>
<preface xml:id="intro.regex">
&reftitle.intro;
<warning>
&warn.deprecated.feature.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member>
<link linkend="book.pcre">PCRE</link>
(for full regular expression support)
</member>
<member>
<function>fnmatch</function>
(for simpler shell style wildcard pattern matching)
</member>
</simplelist>
</warning>
<tip>
<para>
PHP also supports regular expressions using a Perl-compatible syntax
using the <link linkend="book.pcre">PCRE functions</link>. Those functions
support non-greedy matching, assertions, conditional subpatterns, and a
number of other features not supported by the POSIX-extended regular
expression syntax.
</para>
</tip>
<warning>
<para>
These regular expression functions are not binary-safe. The <link
linkend="book.pcre">PCRE functions</link> are.
</para>
</warning>
<para>
Regular expressions are used for complex string manipulation.
PHP uses the POSIX extended regular expressions as defined by POSIX
1003.2. For a full description of POSIX regular expressions see the <link xlink:href="&url.regex.man;">regex
man pages</link> included in the regex directory in the PHP distribution. It's
in manpage format, so you'll want to do something along the lines of
<command>man /usr/local/src/regex/regex.7</command> in order to read it.
</para>
</preface>
&reference.regex.setup;
&reference.regex.constants;
&reference.regex.examples;
&reference.regex.reference;
</book>
<!-- 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:"~/.phpdoc/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
-->

View file

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="regex.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<section xml:id="regex.installation.php7">
<title>PHP 7</title>
<para>
&pecl.info;
<link xlink:href="&url.pecl.package;regex">&url.pecl.package;regex</link>.
</para>
</section>
<section xml:id="regex.installation.php5">
<title>PHP 5</title>
<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
<literal>system</literal>, <literal>apache</literal>, <literal>php</literal>.
The default value is <literal>php</literal>.
</para>
&windows.builtin;
</section>
</section>
<!-- 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:"~/.phpdoc/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
-->

View file

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="regex.constants">
&reftitle.constants;
&no.constants;
</appendix>
<!-- 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:"~/.phpdoc/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
-->

View file

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="regex.examples">
&reftitle.examples;
<para>
<example>
<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 at the beginning of $string.
ereg("^abc", $string);
// Returns true if "abc" is found at the end of $string.
ereg("abc$", $string);
// Returns true if client browser is Netscape 2, 3 or MSIE 3.
eregi("(ozilla.[23]|MSIE.3)", $_SERVER["HTTP_USER_AGENT"]);
// Places three space separated words into $regs[1], $regs[2] and $regs[3].
ereg("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)", $string, $regs);
// Put a <br /> tag at the beginning of $string.
$string = ereg_replace("^", "<br />", $string);
// Put a <br /> tag at the end of $string.
$string = ereg_replace("$", "<br />", $string);
// Get rid of any newline characters in $string.
$string = ereg_replace("\n", "", $string);
?>
]]>
</programlisting>
</example>
</para>
</appendix>
<!-- 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:"~/.phpdoc/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
-->

View file

@ -1,181 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ereg-replace">
<refnamediv>
<refname>ereg_replace</refname>
<refpurpose>Replace regular expression</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&warn.deprecated.function.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member><function>preg_replace</function></member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<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
with <parameter>replacement</parameter>.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>pattern</parameter></term>
<listitem>
<para>
A POSIX extended regular expression.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>replacement</parameter></term>
<listitem>
<para>
If <parameter>pattern</parameter> contains parenthesized substrings,
<parameter>replacement</parameter> may contain substrings of the form
<literal>\<replaceable>digit</replaceable></literal>, which will be
replaced by the text matching the digit'th parenthesized substring;
<literal>\0</literal> will produce the entire contents of string.
Up to nine substrings may be used. Parentheses may be nested, in which
case they are counted by the opening parenthesis.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The modified string is returned. If no matches are found in
<parameter>string</parameter>, then it will be returned unchanged.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
For example, the following code snippet prints "This was a test"
three times:
</para>
<para>
<example>
<title><function>ereg_replace</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$string = "This is a test";
echo str_replace(" is", " was", $string);
echo ereg_replace("( )is", "\\1was", $string);
echo ereg_replace("(( )is)", "\\2was", $string);
?>
]]>
</programlisting>
</example>
</para>
<para>
One thing to take note of is that if you use an integer value as
the <parameter>replacement</parameter> parameter, you may not get
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>
<programlisting role="php">
<![CDATA[
<?php
/* This will not work as expected. */
$num = 4;
$string = "This string has four words.";
$string = ereg_replace('four', $num, $string);
echo $string; /* Output: 'This string has words.' */
/* This will work. */
$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>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>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ereg</function></member>
<member><function>eregi</function></member>
<member><function>eregi_replace</function></member>
<member><function>str_replace</function></member>
<member><function>preg_replace</function></member>
<member><function>quotemeta</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->

View file

@ -1,177 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ereg">
<refnamediv>
<refname>ereg</refname>
<refpurpose>Regular expression match</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&warn.deprecated.function.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member><function>preg_match</function></member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</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 role="reference">regs</parameter></methodparam>
</methodsynopsis>
<simpara>
Searches a <parameter>string</parameter> for matches to the regular
expression given in <parameter>pattern</parameter> in a case-sensitive
way.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>pattern</parameter></term>
<listitem>
<para>
Case sensitive regular expression.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>regs</parameter></term>
<listitem>
<para>
If matches are found for parenthesized substrings of
<parameter>pattern</parameter> and the function is called with the
third argument <parameter>regs</parameter>, the matches will be stored
in the elements of the array <parameter>regs</parameter>.
</para>
<para>
<varname>$regs[1]</varname> will contain the substring which starts at
the first left parenthesis; <varname>$regs[2]</varname> will contain
the substring starting at the second, and so on.
<varname>$regs[0]</varname> will contain a copy of the complete string
matched.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the length of the matched string if a match for
<parameter>pattern</parameter> was found in <parameter>string</parameter>,
or &false; if no matches were found or an error occurred.
</para>
<para>
If the optional parameter <parameter>regs</parameter> was not passed or
the length of the matched string is <literal>0</literal>, this function returns <literal>1</literal>.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>4.1.0</entry>
<entry>
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>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>ereg</function> example</title>
<para>
The following code snippet takes a date in ISO format (YYYY-MM-DD) and
prints it in DD.MM.YYYY format:
</para>
<programlisting role="php">
<![CDATA[
<?php
if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $regs)) {
echo "$regs[3].$regs[2].$regs[1]";
} else {
echo "Invalid date format: $date";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>eregi</function></member>
<member><function>ereg_replace</function></member>
<member><function>eregi_replace</function></member>
<member><function>preg_match</function></member>
<member><function>strpos</function></member>
<member><function>strstr</function></member>
<member><function>quotemeta</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->

View file

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.eregi-replace">
<refnamediv>
<refname>eregi_replace</refname>
<refpurpose>Replace regular expression case insensitive</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&warn.deprecated.function.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member>
<function>preg_replace</function>
(with the <literal>i</literal> (<constant>PCRE_CASELESS</constant>)
modifier)
</member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<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
alphabetic characters.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>pattern</parameter></term>
<listitem>
<para>
A POSIX extended regular expression.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>replacement</parameter></term>
<listitem>
<para>
If <parameter>pattern</parameter> contains parenthesized substrings,
<parameter>replacement</parameter> may contain substrings of the form
<literal>\<replaceable>digit</replaceable></literal>, which will be
replaced by the text matching the digit'th parenthesized substring;
<literal>\0</literal> will produce the entire contents of string.
Up to nine substrings may be used. Parentheses may be nested, in which
case they are counted by the opening parenthesis.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The modified string is returned. If no matches are found in
<parameter>string</parameter>, then it will be returned unchanged.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Highlight search results</title>
<programlisting role="php">
<![CDATA[
<?php
$pattern = '(>[^<]*)('. quotemeta($_GET['search']) .')';
$replacement = '\\1<span class="search">\\2</span>';
$body = eregi_replace($pattern, $replacement, $body);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ereg</function></member>
<member><function>eregi</function></member>
<member><function>ereg_replace</function></member>
<member><function>preg_replace</function></member>
<member><function>quotemeta</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->

View file

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.eregi">
<refnamediv>
<refname>eregi</refname>
<refpurpose>Case insensitive regular expression match</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&warn.deprecated.function.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member>
<function>preg_match</function>
(with the <literal>i</literal> (<constant>PCRE_CASELESS</constant>)
modifier)
</member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</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 role="reference">regs</parameter></methodparam>
</methodsynopsis>
<para>
This function is identical to <function>ereg</function> except that it
ignores case distinction when matching alphabetic characters.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>pattern</parameter></term>
<listitem>
<para>
Case insensitive regular expression.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>regs</parameter></term>
<listitem>
<para>
If matches are found for parenthesized substrings of
<parameter>pattern</parameter> and the function is called with the
third argument <parameter>regs</parameter>, the matches will be stored
in the elements of the array <parameter>regs</parameter>.
</para>
<para>
<varname>$regs[1]</varname> will contain the substring which starts at
the first left parenthesis; <varname>$regs[2]</varname> will contain
the substring starting at the second, and so on.
<varname>$regs[0]</varname> will contain a copy of the complete string
matched.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the length of the matched string if a match for
<parameter>pattern</parameter> was found in <parameter>string</parameter>,
or &false; if no matches were found or an error occurred.
</para>
<para>
If the optional parameter <parameter>regs</parameter> was not passed or
the length of the matched string is <literal>0</literal>, this function returns <literal>1</literal>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>eregi</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$string = 'XYZ';
if (eregi('z', $string)) {
echo "'$string' contains a 'z' or 'Z'!";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ereg</function></member>
<member><function>ereg_replace</function></member>
<member><function>eregi_replace</function></member>
<member><function>preg_match</function></member>
<member><function>stripos</function></member>
<member><function>stristr</function></member>
<member><function>quotemeta</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->

View file

@ -1,190 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.split">
<refnamediv>
<refname>split</refname>
<refpurpose>Split string into array by regular expression</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&warn.deprecated.function.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member><function>preg_split</function></member>
<member><function>explode</function></member>
<member><function>str_split</function></member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<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><initializer>-1</initializer></methodparam>
</methodsynopsis>
<para>
Splits a <parameter>string</parameter> into array by regular expression.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>pattern</parameter></term>
<listitem>
<para>
Case sensitive regular expression.
</para>
<para>
If you want to split on any of the characters which are considered
special by regular expressions, you'll need to escape them first. If
you think <function>split</function> (or any other regex function, for
that matter) is doing something weird, please read the file
<filename>regex.7</filename>, included in the
<filename>regex/</filename> subdirectory of the PHP distribution. It's
in manpage format, so you'll want to do something along the lines of
<command>man /usr/local/src/regex/regex.7</command> in order to read it.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>limit</parameter></term>
<listitem>
<para>
If <parameter>limit</parameter> is set, the returned array will
contain a maximum of <parameter>limit</parameter> elements with the
last element containing the whole rest of
<parameter>string</parameter>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<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 case-sensitive regular expression <parameter>pattern</parameter>.
</para>
<para>
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. If an error occurs,
<function>split</function> returns &false;.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>split</function> example</title>
<para>
To split off the first four fields from a line from
<filename>/etc/passwd</filename>:
</para>
<programlisting role="php">
<![CDATA[
<?php
list($user, $pass, $uid, $gid, $extra) =
split(":", $passwd_line, 5);
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title><function>split</function> example</title>
<para>
To parse a date which may be delimited with slashes, dots, or hyphens:
</para>
<programlisting role="php">
<![CDATA[
<?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>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<tip>
<para>
<function>split</function> is deprecated as of PHP 5.3.0. <function>preg_split</function>
is the suggested alternative to this 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>
</tip>
<tip>
<para>
For users looking for a way to emulate Perl's <command>@chars =
split('', $str)</command> behaviour, please see the examples for
<function>preg_split</function> or <function>str_split</function>.
</para>
</tip>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>preg_split</function></member>
<member><function>spliti</function></member>
<member><function>str_split</function></member>
<member><function>explode</function></member>
<member><function>implode</function></member>
<member><function>chunk_split</function></member>
<member><function>wordwrap</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->

View file

@ -1,167 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.spliti">
<refnamediv>
<refname>spliti</refname>
<refpurpose>Split string into array by regular expression case insensitive</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&warn.deprecated.function.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member>
<function>preg_split</function>
(with the <literal>i</literal> (<constant>PCRE_CASELESS</constant>)
modifier)
</member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<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><initializer>-1</initializer></methodparam>
</methodsynopsis>
<para>
Splits a <parameter>string</parameter> into array by regular expression.
</para>
<para>
This function is identical to <function>split</function> except that this
ignores case distinction when matching alphabetic characters.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>pattern</parameter></term>
<listitem>
<para>
Case insensitive regular expression.
</para>
<para>
If you want to split on any of the characters which are considered
special by regular expressions, you'll need to escape them first. If
you think <function>spliti</function> (or any other regex function, for
that matter) is doing something weird, please read the file
<filename>regex.7</filename>, included in the
<filename>regex/</filename> subdirectory of the PHP distribution. It's
in manpage format, so you'll want to do something along the lines of
<command>man /usr/local/src/regex/regex.7</command> in order to read it.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>limit</parameter></term>
<listitem>
<para>
If <parameter>limit</parameter> is set, the returned array will
contain a maximum of <parameter>limit</parameter> elements with the
last element containing the whole rest of
<parameter>string</parameter>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<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 case insensitive regular expression <parameter>pattern</parameter>.
</para>
<para>
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. If an error occurs,
<function>spliti</function> returns &false;.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
This example splits a string using 'a' as the separator :
<example>
<title><function>spliti</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$string = "aBBBaCCCADDDaEEEaGGGA";
$chunks = spliti ("a", $string, 5);
print_r($chunks);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[0] =>
[1] => BBB
[2] => CCC
[3] => DDD
[4] => EEEaGGGA
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>preg_split</function></member>
<member><function>split</function></member>
<member><function>explode</function></member>
<member><function>implode</function></member>
</simplelist>
</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:"~/.phpdoc/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
-->

View file

@ -1,104 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.sql-regcase">
<refnamediv>
<refname>sql_regcase</refname>
<refpurpose>Make regular expression for case insensitive match</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&warn.deprecated.function.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member><function>preg_match</function></member>
<member><function>preg_quote</function></member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>sql_regcase</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
Creates a regular expression for a case insensitive match.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The input string.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a valid regular expression which will match
<parameter>string</parameter>, ignoring case. This expression is
<parameter>string</parameter> with each alphabetic character converted to
a bracket expression; this bracket expression contains that character's
uppercase and lowercase form. Other characters remain unchanged.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sql_regcase</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo sql_regcase("Foo - bar.");
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
[Ff][Oo][Oo] - [Bb][Aa][Rr].
]]>
</screen>
</example>
</para>
<para>
This can be used to achieve case insensitive pattern matching in
products which support only case sensitive regular expressions.
</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:"~/.phpdoc/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
-->

View file

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="ref.regex" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>POSIX Regex &Functions;</title>
<partintro xml:id="regex.seealso">
&reftitle.seealso;
<warning>
&warn.deprecated.feature.5-3-0.removed.7-0-0.alternatives;
<simplelist role="alternatives">
<member>
<link linkend="book.pcre">PCRE</link>
(for full regular expression support)
</member>
<member>
<function>fnmatch</function>
(for simpler shell style wildcard pattern matching)
</member>
</simplelist>
</warning>
</partintro>
&reference.regex.entities.functions;
</reference>
<!-- 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:"~/.phpdoc/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
-->

View file

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="regex.setup">
&reftitle.setup;
<section xml:id="regex.requirements">
&reftitle.required;
&no.requirement;
</section>
&reference.regex.configure;
<section xml:id="regex.configuration">
&reftitle.runtime;
&no.config;
</section>
<section xml:id="regex.resources">
&reftitle.resources;
&no.resource;
</section>
</chapter>
<!-- 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:"~/.phpdoc/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
-->

View file

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!--
Do NOT translate this file
-->
<versions>
<function name='ereg' from='PHP 4, PHP 5' deprecated='PHP 5.3.0'/>
<function name='ereg_replace' from='PHP 4, PHP 5' deprecated='PHP 5.3.0'/>
<function name='eregi' from='PHP 4, PHP 5' deprecated='PHP 5.3.0'/>
<function name='eregi_replace' from='PHP 4, PHP 5' deprecated='PHP 5.3.0'/>
<function name='split' from='PHP 4, PHP 5' deprecated='PHP 5.3.0'/>
<function name='spliti' from='PHP 4 &gt;= 4.0.1, PHP 5' deprecated='PHP 5.3.0'/>
<function name='sql_regcase' from='PHP 4, PHP 5' deprecated='PHP 5.3.0'/>
</versions>
<!-- 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:"~/.phpdoc/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
-->