|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34121 Add DFA support to preg_match() function
Submitted: 2005-08-13 14:20 UTC Modified: 2021-09-12 04:22 UTC
Avg. Score:4.2 ± 0.8
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: Assigned: cmb (profile)
Status: No Feedback Package: PCRE related
PHP Version: * OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
New email:
PHP Version: OS:


 [2005-08-13 14:20 UTC]
I've made a patch to add DFA (PCRE 6) support to preg_match().
It isn't completed (yet), because I would like to receive your feedback first before continuing.


 - currently preg_match_*() allocs memory for captures based on the number of capturing parentheses. But this needs to be changed for the DFA mode.
 - make partial matching working. The only thing it needs to be done is to save the workspace table in the cache and reuse it when calling the pcre_dfa_exec() function.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-13 14:21 UTC]
Assigning to Andrei, as he's the PCRE extension maintainter.
 [2005-08-15 20:52 UTC]
OK, patch revised.
I've added support for partial matching. This can be usefull, for example, in a CLI app to beep when a user enters a bad char (by doing partial matching when a new char comes in).

TODO: make preg_match_all() fetch all the data (instead of the hardcoded limit). this may be tricky.
 [2010-12-20 09:40 UTC]
-Package: Feature/Change Request +Package: PCRE related -PHP Version: 5CVS-2005-08-13 (dev) +PHP Version: *
 [2017-10-24 06:00 UTC]
-Status: Assigned +Status: Open -Assigned To: andrei +Assigned To:
 [2021-08-31 09:35 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-31 09:35 UTC]
That might be an interesting feature, but the patch is no longer
available (and likely went stale in the meantime).  If you're
still interested in DFA matching, please provide a pull

[1] <>
 [2021-09-12 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 20:01:29 2024 UTC