mirror of
https://github.com/php/php-src.git
synced 2024-10-17 06:22:53 +00:00
36 lines
1.4 KiB
Plaintext
36 lines
1.4 KiB
Plaintext
- Allow NULL for $matches argument (helps when using preg_match only for
|
|
match condition) - might not be possible
|
|
|
|
- http://bugs.php.net/bug.php?id=36983
|
|
http://bugs.php.net/bug.php?id=33151
|
|
|
|
- I'd love to see a pattern modifer which says "don't fill $matches except
|
|
for the overall match and any specific named captures". This would allow
|
|
(?: ...) to be avoided in a lot of cases.
|
|
|
|
This could make for non-trivial speed enhancements with regexes that have
|
|
a lot of parens when working on long strings, since you'd not have to
|
|
copy them multiple times to the $matches array.
|
|
|
|
Also, it makes $matches much cleaner after a match where you've named the
|
|
captures you're interested in.
|
|
|
|
(Note that this would not involve the use of PCRE_NO_AUTO_CAPTURE, as
|
|
that would change the semantics of backreferences)
|
|
|
|
- In looking at preg_grep, I think it'd be pretty easy to implement some flags:
|
|
|
|
PREG_GREP_REKEY_ALL --- all key values are rekeyed, as if return array had been
|
|
passed through array_values().
|
|
|
|
PREG_GREP_REKEY_NUMS --- only numeric key values are rekeyed; string key values
|
|
are maintained
|
|
|
|
PREG_GREP_REKEY_NONE ---- (default and current situation) keys are maintained
|
|
|
|
I can't judge the social effect of changing the default, but my intuition
|
|
of a grep function in PHP would be that the default is PREG_GREP_REKEY_NUMS
|
|
or PREG_GREP_REKEY_ALL....
|
|
|
|
|