php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #33259 & Integer Matching
Submitted: 2005-06-07 03:07 UTC Modified: 2006-11-11 01:56 UTC
From: admin at ninthcircuit dot info Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.0.4 OS: Linux
Private report: No CVE-ID: None
 [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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-07 03:10 UTC] admin at ninthcircuit dot info
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
 [2006-11-11 01:56 UTC] tony2001@php.net
.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat May 28 18:05:45 2022 UTC