reference/mbstring/functions/mb-ereg.xml
9240fafbb22e3331c643c31b55ea599fa5ca1053
...
...
@@ -9,10 +9,10 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>int</type><methodname>mb_ereg</methodname>
12
+
<type>bool</type><methodname>mb_ereg</methodname>
13
13
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
14
14
<methodparam><type>string</type><parameter>string</parameter></methodparam>
15
-
<methodparam choice="opt"><type>array</type><parameter role="reference">regs</parameter></methodparam>
15
+
<methodparam choice="opt"><type>array</type><parameter role="reference">matches</parameter><initializer>&null;</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<simpara>
18
18
Executes the regular expression match with multibyte support.
...
...
@@ -40,10 +40,22 @@
40
40
</listitem>
41
41
</varlistentry>
42
42
<varlistentry>
43
-
<term><parameter>regs</parameter></term>
43
+
<term><parameter>matches</parameter></term>
44
44
<listitem>
45
45
<para>
46
-
Contains a substring of the matched <type>string</type>.
46
+
If matches are found for parenthesized substrings of
47
+
<parameter>pattern</parameter> and the function is called with the
48
+
third argument <parameter>matches</parameter>, the matches will be stored
49
+
in the elements of the array <parameter>matches</parameter>.
50
+
If no matches are found, <parameter>matches</parameter> is set to an empty
51
+
array.
52
+
</para>
53
+
<para>
54
+
<varname>$matches[1]</varname> will contain the substring which starts at
55
+
the first left parenthesis; <varname>$matches[2]</varname> will contain
56
+
the substring starting at the second, and so on.
57
+
<varname>$matches[0]</varname> will contain a copy of the complete string
58
+
matched.
47
59
</para>
48
60
</listitem>
49
61
</varlistentry>
...
...
@@ -53,18 +65,45 @@
53
65
54
66
<refsect1 role="returnvalues">
55
67
&reftitle.returnvalues;
56
-
<simpara>
57
-
Executes the regular expression
58
-
match with multibyte support, and returns <literal>1</literal> if matches are found.
59
-
If the optional <parameter>regs</parameter> parameter was specified, the function
60
-
returns the byte length of matched part, and the <type>array</type>
61
-
<parameter>regs</parameter> will contain the substring of matched
62
-
string. The function returns <literal>1</literal> if it matches with the empty
63
-
string. If no matches are found or an error happens, &false; will be
64
-
returned.
65
-
</simpara>
68
+
<para>
69
+
Returns whether <parameter>pattern</parameter> matches <parameter>string</parameter>.
70
+
</para>
66
71
</refsect1>
67
72

73
+
<refsect1 role="changelog"><!-- {{{ -->
74
+
&reftitle.changelog;
75
+
<informaltable>
76
+
<tgroup cols="2">
77
+
<thead>
78
+
<row>
79
+
<entry>&Version;</entry>
80
+
<entry>&Description;</entry>
81
+
</row>
82
+
</thead>
83
+
<tbody>
84
+
<row>
85
+
<entry>8.0.0</entry>
86
+
<entry>
87
+
This function returns &true; on success now. Previously, it returned the byte length
88
+
of the matched string if a match for <parameter>pattern</parameter> was found in
89
+
<parameter>string</parameter> and <parameter>matches</parameter> was passed.
90
+
If the optional parameter <parameter>matches</parameter> was not passed or
91
+
the length of the matched string was <literal>0</literal>, this function returned <literal>1</literal>.
92
+
</entry>
93
+
</row>
94
+
<row>
95
+
<entry>7.1.0</entry>
96
+
<entry>
97
+
<function>mb_ereg</function> will now set <parameter>matches</parameter> to
98
+
an empty <type>array</type>, if nothing matched. Formerly,
99
+
<parameter>matches</parameter> was not modified in that case.
100
+
</entry>
101
+
</row>
102
+
</tbody>
103
+
</tgroup>
104
+
</informaltable>
105
+
</refsect1><!-- }}} -->
106
+

68
107
<refsect1 role="notes">
69
108
&reftitle.notes;
70
109
...
...
@@ -82,7 +121,6 @@
82
121
</refsect1>
83
122

84
123
</refentry>
85
-

86
124
<!-- Keep this comment at the end of the file
87
125
Local variables:
88
126
mode: sgml
89
127