|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-06-07 03:07 UTC] admin at ninthcircuit dot info
Description:
------------
I was wondering what the PHP community would think of adding an "integer matching" feature.
For instance, we have the asterisk ("*") and the question mark ("?") which denote multiple wildcard matching and single wildcard matching, respectively. Well, how about adding pound ("#") for multi-character integer matching and ampersand ("&") for single integer matching as well?
Output synopsis of corresponding wildcard traits:
Asterisk: foo* {Returns: foo, foo1, foobar, fooasdf, etc.}
Question: foo? {Returns: foo1, fooA, foo^, foo>, foo#, etc.}
Ampersand: foo& {Returns: foo1, foo2, foo3, foo4, foo5, etc.}
Pound: foo# {Returns: foo1,foo234,foo10040,foo71, foo, etc.}
Note the exception in the pound symbol feature: Unlike the asterisk, a pound being added to a regex indicates that AT LEAST one number must exist in the compared string in order for it to match. Naturally the ampersand follows this rule, also.
There are a variety of uses this new feature could have. Traversing arrays with numeric indeces, searching a file, binary searches, etc.
Thanks
-M
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 00:00:01 2025 UTC |
In the submission where it says "Pound: foo# {Returns...}" Ignore the part where it shows only "foo" .. as this is not a valid matching result to the specification I supplied for "#". Thanks