php.net |  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
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:2 of 3 (66.7%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: nlopess@php.net Assigned: cmb (profile)
Status: No Feedback Package: PCRE related
PHP Version: * OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-08-13 14:20 UTC] nlopess@php.net
Description:
------------
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.

patch: http://mega.ist.utl.pt/~ncpl/php_pcre_dfa.txt
example: http://mega.ist.utl.pt/~ncpl/dfa_example.php


TODO:
 - 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-13 14:21 UTC] nlopess@php.net
Assigning to Andrei, as he's the PCRE extension maintainter.
 [2005-08-15 20:52 UTC] nlopess@php.net
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] jani@php.net
-Package: Feature/Change Request +Package: PCRE related -PHP Version: 5CVS-2005-08-13 (dev) +PHP Version: *
 [2017-10-24 06:00 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: andrei +Assigned To:
 [2021-08-31 09:35 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-31 09:35 UTC] cmb@php.net
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
request[1].

[1] <https://github.com/php/php-src/pulls>
 [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-2021 The PHP Group
All rights reserved.
Last updated: Wed Sep 29 03:03:33 2021 UTC