[asterisk-dev] Better pattern matching

John Todd jtodd at loligo.com
Wed Aug 1 16:49:02 CDT 2007

At 2:48 PM -0400 2007/8/1, Jared Smith wrote:
>On Wed, 2007-08-01 at 11:44 -0500, John Lange wrote:
>>  Searching the archives I can see that better pattern matching has been
>>  discussed a number of times.
>>  There have even been patches submitted and discussions about how there
>>  are regexp libraries available under BSD style license that could be
>>  incorporated into Asterisk.
>>  Yet, nothing ever makes it into the released code.
>Yes, I've been one of the people who have been more vocal than most
>about this.  I really think it's a good idea to be a little more
>flexible in our pattern matching ability.  That being said, I can see
>where the Asterisk developers are coming from too -- they're worried
>that this will severely impact the time it takes for Asterisk to do
>pattern matching.  The current pattern matching syntax works fairly well
>for numeric extensions, but is pretty difficult work with if you trying
>to do pattern matching on names or alphanumeric extensions.  For
>example, try coming up with a pattern match that'll match the name Nancy
>(either upper or lower case) followed by two digits.  It becomes even
>more difficult when dealing with letters that fall outside the English
>While I personally think regular expressions are a pretty cool idea, I
>know not everyone is sold on them.  If I remember correctly, there's
>even an RFC with a very complete pattern matching syntax defined (which
>I can't find right now, of course).
>Hopefully, one of the Asterisk developers will stumble across this post
>and take pity on us and help us out!
>Jared Smith
>Community Relations Manager
>Digium, Inc.

Put me down for a hearty "Me too!" on this, as I've also chimed in on 
the two or three other times this discussion has come up in the past. 
I'm doing quite a bit with SIP expression matching now, and Asterisk 
is falling short on it's ability to handle alphanumerics, which is 
forcing me to do some really ugly hacks with CUT and various other 
string manipulation functions in order to make matching work the 
right way.  While I understand the reasons for how matching is done 
today, there really needs to be some work put into making the 
expression matching in Asterisk more closely mirror the useful 
expression matching that exists in the rest of the world of string 
handling applications.  The PCRE stuff looks promising...

As usual, I'll put my money (or a small bit of my company's money) 
where my mouth is and say that I'll put some funding towards getting 
this improved, since I can't code it myself.


More information about the asterisk-dev mailing list