diff --git a/reference/spl/iterators.xml b/reference/spl/iterators.xml
index b4eaefa902..47a93cc429 100644
--- a/reference/spl/iterators.xml
+++ b/reference/spl/iterators.xml
@@ -1,5 +1,5 @@
-
+
@@ -17,7 +17,6 @@
RecursiveFilterIterator
RecursiveRegexIterator
RecursiveTreeIterator
- RegexIterator
@@ -28,7 +27,6 @@
&reference.spl.recursivefilteriterator;
&reference.spl.recursiveregexiterator;
&reference.spl.recursivetreeiterator;
- &reference.spl.regexiterator;
-->
&reference.spl.appenditerator;
@@ -48,6 +46,7 @@
&reference.spl.recursivecachingiterator;
&reference.spl.recursivedirectoryiterator;
&reference.spl.recursiveiteratoriterator;
+ &reference.spl.regexiterator;
&reference.spl.simplexmliterator;
diff --git a/reference/spl/regexiterator.xml b/reference/spl/regexiterator.xml
new file mode 100644
index 0000000000..51baf8b021
--- /dev/null
+++ b/reference/spl/regexiterator.xml
@@ -0,0 +1,192 @@
+
+
+
+ The RegexIterator class
+
+
+
+
+
+
+ &reftitle.intro;
+
+ This iterator can be used to filter another iterator via a regular expression.
+
+
+
+
+
+ &reftitle.classsynopsis;
+
+
+
+ RegexIterator
+
+
+
+
+ RegexIterator
+
+
+
+ extends
+ FilterIterator
+
+
+
+ Constants
+
+ const
+ integer
+ MATCH
+ 0
+
+
+ const
+ integer
+ GET_MATCH
+ 1
+
+
+ const
+ integer
+ ALL_MATCHES
+ 2
+
+
+ const
+ integer
+ SPLIT
+ 3
+
+
+ const
+ integer
+ REPLACE
+ 4
+
+
+ const
+ integer
+ USE_KEY
+ 1
+
+
+
+
+
+
+ Methods
+
+
+
+ Inherited methods
+
+
+
+
+
+
+ &reftitle.constants;
+
+ RegexIterator operation modes
+
+
+
+ RegexIterator::ALL_MATCHES
+
+ Return all matches for the current entry (see preg_match_all).
+
+
+
+
+ RegexIterator::GET_MATCH
+
+ Return the first match for the current entry (see preg_match).
+
+
+
+
+ RegexIterator::MATCH
+
+ Only execute match (filter) for the current entry (see preg_match).
+
+
+
+
+ RegexIterator::REPLACE
+
+ Replace the current entry or the current key (see preg_replace).
+
+
+
+
+ RegexIterator::SPLIT
+
+ Returns the split values for the current entry (see preg_split).
+
+
+
+
+
+ RegexIterator Flags
+
+
+ RegexIterator::USE_KEY
+
+ Special flag: Match the entry key instead of the entry valye.
+
+
+
+
+
+
+
+
+
+
+
+ &reference.spl.entities.regexiterator;
+
+
+
+
+
diff --git a/reference/spl/regexiterator/construct.xml b/reference/spl/regexiterator/construct.xml
new file mode 100644
index 0000000000..446ad4c572
--- /dev/null
+++ b/reference/spl/regexiterator/construct.xml
@@ -0,0 +1,187 @@
+
+
+
+
+
+ RegexIterator::__construct
+ Creates a new RegexIterator.
+
+
+
+ &reftitle.description;
+
+ RegexIterator::__construct
+ Iteratoriterator
+ stringregex
+ intmode
+ intflags
+ intpreg_flags
+
+
+
+ Creates a new regular expression iterator.
+
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ iterator
+
+
+ The iterator to apply this regex filter to.
+
+
+
+
+ regex
+
+
+ The regular expression to match.
+
+
+
+
+ mode
+
+
+ Operation mode, see RegexIterator::setMode for a list
+ of mode.
+
+
+
+
+ flags
+
+
+ Special flags, see RegexIterator::setFlags for a list
+ of available flags.
+
+
+
+
+ preg_flags
+
+
+ The regular expression flags. These flags depend on the operation mode parameter:
+
+
+
+ RegexIterator preg_flags
+
+
+
+ operation mode
+ available flags
+
+
+
+
+ RegexIterator::ALL_MATCHES
+
+ See preg_match_all.
+
+
+
+ RegexIterator::GET_MATCH
+
+ See preg_match.
+
+
+
+ RegexIterator::MATCH
+
+ See preg_match.
+
+
+
+ RegexIterator::REPLACE
+
+ none.
+
+
+
+ RegexIterator::SPLIT
+
+ See preg_split.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.examples;
+
+
+ RegexIterator::__construct example
+
+ Creates a new RegexIterator that filters all strings that start with 'test'.
+
+
+
+]]>
+
+ &example.outputs.similar;
+
+
+
+
+
+
+
+
+ &reftitle.seealso;
+
+
+ preg_match
+ preg_match_all
+ preg_replace
+ preg_split
+
+
+
+
+
+
+
+
diff --git a/reference/spl/regexiterator/getflags.xml b/reference/spl/regexiterator/getflags.xml
new file mode 100644
index 0000000000..3a748d98c5
--- /dev/null
+++ b/reference/spl/regexiterator/getflags.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+ RegexIterator::getFlags
+ Returns the special flags.
+
+
+
+ &reftitle.description;
+
+
+ intRegexIterator::getFlags
+
+
+
+ Returns the special flags, see RegexIterator::setFlags
+ for the list of special flags.
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the special flags.
+
+
+
+
+ &reftitle.seealso;
+
+
+ RegexIterator::setFlags
+
+
+
+
+
+
+
diff --git a/reference/spl/regexiterator/getmode.xml b/reference/spl/regexiterator/getmode.xml
new file mode 100644
index 0000000000..9140c9eb64
--- /dev/null
+++ b/reference/spl/regexiterator/getmode.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+ RegexIterator::getMode
+ Returns operation mode.
+
+
+
+ &reftitle.description;
+
+
+ intRegexIterator::getMode
+
+
+
+ Returns the operation mode, see RegexIterator::setMode
+ for the list of operation modes.
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the operation mode.
+
+
+
+
+ &reftitle.seealso;
+
+
+ RegexIterator::setMode
+
+
+
+
+
+
+
diff --git a/reference/spl/regexiterator/getpregflags.xml b/reference/spl/regexiterator/getpregflags.xml
new file mode 100644
index 0000000000..8707b9bc9a
--- /dev/null
+++ b/reference/spl/regexiterator/getpregflags.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+ RegexIterator::getPregFlags
+ Returns the regular expression flags.
+
+
+
+ &reftitle.description;
+
+
+ intRegexIterator::getPregFlags
+
+
+
+ Returns the special flags, see RegexIterator::__construct
+ for the list of flags.
+
+
+
+
+ &reftitle.returnvalues;
+
+ Returns the regular expression flags.
+
+
+
+
+ &reftitle.seealso;
+
+
+ RegexIterator::setPregFlags
+
+
+
+
+
+
+
diff --git a/reference/spl/regexiterator/setflags.xml b/reference/spl/regexiterator/setflags.xml
new file mode 100644
index 0000000000..67998227fd
--- /dev/null
+++ b/reference/spl/regexiterator/setflags.xml
@@ -0,0 +1,132 @@
+
+
+
+
+
+ RegexIterator::setFlags
+ Sets the special flags.
+
+
+
+ &reftitle.description;
+
+
+ voidRegexIterator::setFlags
+ intflags
+
+
+ Sets the special flags.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ flags
+
+
+ The special flags. It takes a bitmask of class constants.
+
+
+ The available flags are listed below. The actual
+ meanings of these flags are described in the
+ predefined constants.
+
+ RegexIterator special flags
+
+
+
+ value
+ constant
+
+
+
+
+ 1
+
+ RegexIterator::USE_KEY
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.void;
+
+
+
+
+ &reftitle.examples;
+
+
+ RegexIterator::setFlags example
+
+ Creates a new RegexIterator that filters all entries with where the array key starts with 'test'.
+
+
+ 'test 1', 'teststr2' => 'another test', 'str3' => 'test 123');
+
+$arrayIterator = new ArrayIterator($test);
+$regexIterator = new RegexIterator($arrayIterator, '/^test/');
+$regexIterator->setFlags(RegexIterator::USE_KEY);
+
+foreach ($regexIterator as $key => $value) {
+ echo $key . ' => ' . $value . "\n";
+}
+?>
+]]>
+
+ &example.outputs.similar;
+
+ another test
+]]>
+
+
+
+
+
+
+ &reftitle.seealso;
+
+
+ RegexIterator::getFlags
+
+
+
+
+
+
+
diff --git a/reference/spl/regexiterator/setmode.xml b/reference/spl/regexiterator/setmode.xml
new file mode 100644
index 0000000000..7116b0aa73
--- /dev/null
+++ b/reference/spl/regexiterator/setmode.xml
@@ -0,0 +1,157 @@
+
+
+
+
+
+ RegexIterator::setMode
+ Sets the operation mode.
+
+
+
+ &reftitle.description;
+
+
+ voidRegexIterator::setMode
+ intmode
+
+
+ Sets the operation mode.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ mode
+
+
+ The operation mode.
+
+
+ The available modes are listed below. The actual
+ meanings of these modes are described in the
+ predefined constants.
+
+ RegexIterator modes
+
+
+
+ value
+ constant
+
+
+
+
+ 0
+
+ RegexIterator::MATCH
+
+
+
+ 1
+
+ RegexIterator::GET_MATCH
+
+
+
+ 2
+
+ RegexIterator::ALL_MATCHES
+
+
+
+ 3
+
+ RegexIterator::SPLIT
+
+
+
+ 4
+
+ RegexIterator::REPLACE
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.void;
+
+
+
+
+ &reftitle.examples;
+
+
+ RegexIterator::setMode example
+
+ 'test 1', 'test str2' => 'another test', 'str3' => 'test 123');
+
+$arrayIterator = new ArrayIterator($test);
+// Filter everything that starts with 'test ' followed by one or more numbers.
+$regexIterator = new RegexIterator($arrayIterator, '/^test (\d+)/');
+// Operation mode: Replace actual value with the matches
+$regexIterator->setMode(RegexIterator::GET_MATCH);
+
+foreach ($regexIterator as $key => $value) {
+ // print out the matched number(s)
+ echo $key . ' => ' . $value[1] . "\n";
+}
+?>
+]]>
+
+ &example.outputs.similar;
+
+ 1
+str3 => 123
+]]>
+
+
+
+
+
+
+ &reftitle.seealso;
+
+
+ RegexIterator::getMode
+
+
+
+
+
+
+
diff --git a/reference/spl/regexiterator/setpregflags.xml b/reference/spl/regexiterator/setpregflags.xml
new file mode 100644
index 0000000000..263beca0ce
--- /dev/null
+++ b/reference/spl/regexiterator/setpregflags.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+ RegexIterator::setPregFlags
+ Sets the regular expression flags.
+
+
+
+ &reftitle.description;
+
+
+ voidRegexIterator::setPregFlags
+ intpreg_flags
+
+
+ Sets the regular expression flags.
+
+
+
+
+ &reftitle.parameters;
+
+
+
+ preg_flags
+
+
+ The regular expression flags. See RegexIterator::__construct
+ for an overview of available flags.
+
+
+
+
+
+
+
+
+ &reftitle.returnvalues;
+
+ &return.void;
+
+
+
+
+ &reftitle.examples;
+
+
+ RegexIterator::setPregFlags example
+
+ Creates a new RegexIterator that filters all entries with where the array key starts with 'test'.
+
+
+setPregFlags(PREG_OFFSET_CAPTURE);
+
+foreach ($regexIterator as $key => $value) {
+ var_dump($value);
+}
+?>
+]]>
+
+ &example.outputs.similar;
+
+
+ array(2) {
+ [0]=>
+ string(4) "test"
+ [1]=>
+ int(0)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(4) "test"
+ [1]=>
+ int(0)
+ }
+}
+]]>
+
+
+
+
+
+
+ &reftitle.seealso;
+
+
+ RegexIterator::getPregFlags
+
+
+
+
+
+
+