# ext/filter, preg_* compatibility

- Thread: https://externals.io/message/22690
- Original archive: https://news-web.php.net/php.internals/22690
- Started by Pierre on 2006-04-09T16:33:01+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #22690 — Pierre — 2006-04-09T16:33:01+00:00

URL: https://externals.io/message/22690#22690

Hello,

While testing pecl/filter, I noticed that many tests fail. Many of the
errors are related to the `FILTER_VALIDATE_REGEXP` mode.

This mode uses pcre natively to compile and execute the give regex. It
is not compatible with the php pcre extension, which makes its usage a
bit tricky, to port existing applications is even more annoying.

Here is a first patch:

http://pear.php.net/~pierre/filter_pcre.txt

It uses pcre_get_compiled_regex from ext/pcre to compile the regex and
fixes a little bug (matches can zero, see the comment).

The benefits are:

- compatible with ext/pcre
- use of the compiled expressions cache

It would also be nice if every additions to ext/filter will use the
ext/pcre API.

--Pierre
