diff --git a/reference/pcre/functions/preg-filter.xml b/reference/pcre/functions/preg-filter.xml new file mode 100644 index 0000000000..97479bbb1e --- /dev/null +++ b/reference/pcre/functions/preg-filter.xml @@ -0,0 +1,168 @@ + + + + + preg_filter + Perform a regular expression search and replace + + + + &reftitle.description; + + mixedpreg_filter + mixedpattern + mixedreplacement + mixedsubject + intlimit-1 + intcount + + + preg_filter is identical to preg_replace + except it only returns the matches. For details about how this function works, + read the preg_replace documentation. + + + + + &reftitle.parameters; + + + + pattern + + + + + + + replacement + + + + + + + subject + + + + + + + limit + + + + + + + count + + + + + + + + + + + &reftitle.returnvalues; + + Returns an array if the subject + parameter is an array, or a string otherwise. + + + If matches are found, the new subject will + be returned, otherwise subject will be + returned unchanged or &null; if an error occurred. + + + + + &reftitle.examples; + + + + Example comparing <function>preg_filter</function> + with <function>preg_replace</function> + + + +]]> + + &example.outputs; + + A:C:1 + [1] => B:C:a + [2] => A:2 + [3] => B:b + [4] => A:3 + [7] => A:4 +) +preg_replace returns +Array +( + [0] => A:C:1 + [1] => B:C:a + [2] => A:2 + [3] => B:b + [4] => A:3 + [5] => A + [6] => B + [7] => A:4 +) +]]> + + + + + + + &reftitle.seealso; + + + preg_replace + preg_replace_callback + preg_match + preg_split + + + + + +