[asterisk-dev] Better pattern matching

John Lange john.lange at open-it.ca
Wed Aug 1 14:53:56 CDT 2007


On Wed, 2007-08-01 at 14:48 -0400, Jared Smith wrote:
>  they're worried
> that this will severely impact the time it takes for Asterisk to do
> pattern matching.

There is no reason why Asterisk can't continue to support it's existing
system using the "_" (underscore) to indicate the old system and some
other character (maybe enclose the regex in "/" like many other
languages) to indicated the next expressions is a regex.

That provides complete backwards compatibility, causes zero performance
hit for anyone who doesn't need regex, and accomplishes the goal of
better pattern matching.

>  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!

Personally I don't support writing a regex engine from scratch for
implementation in Asterisk if that is what is required. I'm under the
assumption (perhaps wrongly) that there is a regex library available in
a suitable (BSD?) style license.

This must be true since the various BSDs certainly have regex pattern
matching and one of the posts in the archives mentions that very option.

So if that's the case it should be fairly easily to add a call to a
library function that returns true/false if a match is found?

Briefly looking at the existing code I see this is already the way it
works with the existing pattern matching. Mind you I'm not much of a C
programmer so I could be out to lunch.

John





More information about the asterisk-dev mailing list