[asterisk-dev] Better pattern matching

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Aug 3 17:39:31 CDT 2007


On Friday 03 August 2007, Kristian Kielhofner wrote:
> On 8/3/07, John Todd <jtodd at loligo.com> wrote:
> ..snip..
>
> > ; this is a normal context
> > ;
> > [blah]
> > exten => _X.,1,NoOp(The dialstring is ${EXTEN})
> >
> >
> >
> > ; this is an extended regexp context, as noted by
> > ;  the "*_" prefix in the context name, and this
> > ;  context will run a lot slower than [blah] does
> > ;
> > [*_blah-plusplus]
> > exten => ^*NANCY*,1,NoOp(The dialstring contains the string "NANCY")

That should be:

exten => ^.*NANCY.*

This is regex we're talking about, not file globbing.

>   I like this except...  Why not just use regex- as a prefix (like macro-)?
>
> [regex-blah-plusplus]
> exten => ^*NANCY*,1,NoOp(The dialstring contains the string "NANCY")
>
>   Seems less confusing and easier to search for (speaking of grep).

Ick.  The whole point of a prefix is that we DON'T need to flag it another
way.  And I think on the whole, it'd be better to be able (even if we choose
not to use it) to intermix old-style matching and regex, using regex just for
the priorities which need the additional functionality.

This prefix is modelled after app_macro, which is going to be deprecated in
the next release cycle anyway.

-- 
Tilghman



More information about the asterisk-dev mailing list