[asterisk-users] Matching *, + and # in the dialplan

Steve Murphy murf at digium.com
Wed Oct 15 15:22:09 CDT 2008


On Wed, 2008-10-15 at 09:06 -0400, Jared Smith wrote:
> On Tue, 2008-10-14 at 19:59 -0500, Karl Fife wrote:
> > QUESTION: Is there a way to do just that?  As in: match:
> > one more of the preceding character or expression (a variation on '.')
> > zero more of the preceding character or expression (a variation on bang)
> 
> No, there's currently nothing in the Asterisk pattern matching syntax to
> constrain one digit to be related in any fashion to the preceding digit.
> 

Jared is correct.

What you really want is the RE *, +, and maybe even () features.
Not to mention '?'...

Some RE features would be easy to implement in the trie, but
the real killer is trailing context...  for instance...

XX[58]*ZZ

If you give it the pattern 3358, it has to decide that
the [58]* part is empty and the 58 is matched by ZZ.
And this makes the whole algorithm pretty hairy.
The current notation lends itself to a fast left-to-right
evaluation, without multiple recursive attempts to find
a path that would lead to a match.

But, if you are willing to forego trailing context, 
and make it so any *,+, {x,z}, or ? is at the end of an expression,
like . is now, this could be implemented fairly straightforwardly in our
current pattern matchers.

See my previous conversations in the dev mailing list, back in aug
2007...

let's see:

http://lists.digium.com/pipermail/asterisk-dev/2007-August/028844.html
http://lists.digium.com/pipermail/asterisk-dev/2007-August/028846.html
http://lists.digium.com/pipermail/asterisk-dev/2007-August/028858.html


murf

-- 
Steve Murphy
Software Developer
Digium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3227 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20081015/dd6b34aa/attachment.bin 


More information about the asterisk-users mailing list