[Asterisk-Dev] better pattern matcher
Reini Urban
r.urban at inode.at
Fri Jun 6 05:23:38 MST 2003
John Todd wrote:
> This has been discussed before on the list. Someone correct me if I'm
> wrong on this: The issue is that there are no regular expression
> libraries that can be used in the way that the Asterisk license is
> written. All of them are licensed such that they cannot be bundled into
> a larger package which _optionally_ may not be open-sourced under the
> same license as the library. Asterisk is such a package, so most other
> inclusion libraries are not viable.
>
> If you want to write one, and sign over the rights to the software to
> Digium, we'd all be thrilled to see it! A better and more extensible
> pattern-match engine is sorely needed. While you're at it, make sure it
> understands alphanumerics as well as just numerics; I'd like to see *
> eventually support "real" SIP addresses which incorporate letters as
> well as numbers. :)
well, for the beginning I added support to continue to match after a "."
to be able to add extensions after the dialed number and not only before. :)
e.g "_0N.8500" matches my voicemail extension for all dialed numbers.
I'll commit this short patch on Tuesday, because I have to do more
testing and the weekend is free.
But maybe I add quantifiers also and support
"." for any char,
"+" for "one or more"
"*" for zero or more chars.
This will break existing extensions.
BTW: character classes (alphanumerics) are already supported by [].
[a-z0-9] for example.
I'm not good in interpreting licenses. Can somebody look at the PCRE
license. I always use this in my projects and it should be able to use
this commercially.
>> I have to match against an ending pattern.
>> Something like _09nnnn.8500
>>
>> The problem is that . immediately returns.
>> My suggestion is to use a better matcher like
>> glob or regex or pcre which supports this.
>>
>> Or at least check if there are still characters behind the "." in the
>> pattern to match against.
>> So "." will relate to ".*" in regex or "*" in glob.
>>
>> Will such a patch be considered useful?
--
Reini Urban - Entwicklung - http://inode.at
More information about the asterisk-dev
mailing list