[asterisk-dev] zero-or-more match
Jason Parker
jparker at digium.com
Wed Feb 10 11:16:30 CST 2010
Nick Lewis wrote:
>> Well, the "easy" way would be if there was a special character which
>> repeated the previous pattern zero or more times. Like * in common
>> regular expressions.
>
> I do not see this as a substitute for real dialplan security but it
> would be a useful new feature.
>
> To repeat a "previous pattern" may be too complicated and confusing but
> to repeat a "previous character" would be useful. The % character is
> little used in extensions so could potentially be reassigned as dialplan
> punctuation for the purpose of repeating the previous character. e.g.
>
> "3%" matches "", "3", "33" etc
> "[a-z]%" matches "", "b", "yx" etc
> "X%" matches "", "0", "98" etc
> "3\%" matches "3%"
>
> Another useful feature would be a non-repeating "." that wildcard
> matches just one character. The ? character may be suitable for this
> where "?%" is equivalent to "!" and "??%" is equivalent to "." . I
> currently use "[!-~]" extensively for this purpose but it does not deal
> with whitespace and unprintable ascii.
>
> -- N_L
exten => /realregexhere/,1,Dial(SIP/${EXTEN})
Sadly, that doesn't actually work...
If pattern matching is going to be extended for something like you're
suggesting, I see no reason to not just go all the way with it. This isn't the
first time we've seen requests to add "just a little new feature" to mimic regex.
Proper regex support (ie; man 3 regex) would satisfy many of these types of
complaints. It may be difficult to fit in with the current pattern matcher (I
honestly don't know - I've not looked at it in much depth), but I have no doubt
that a number of the people on this list would be able to accomplish this.
Obviously there are some questions that would need to be answered (for instance,
I realize that my pseudo-syntax above could conflict with callerid matching)
before much time is spent on it, but is this something that would make sense?
Is it actually worth spending time on?
More information about the asterisk-dev
mailing list