<br><br><div class="gmail_quote">On Tue, Feb 16, 2010 at 1:43 AM, Tzafrir Cohen <span dir="ltr"><<a href="mailto:tzafrir.cohen@xorcom.com">tzafrir.cohen@xorcom.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Mon, Feb 15, 2010 at 09:40:31AM -0700, Steve Murphy wrote:<br>
> On Mon, Feb 15, 2010 at 8:25 AM, Lenz Emilitri <<a href="mailto:lenz.loway@gmail.com">lenz.loway@gmail.com</a>> wrote:<br>
><br>
> > Yes but in any case you can enter all of the strings that reasonably match<br>
> > - even if you have variable-length numbers, you will be able to determine<br>
> > that a valid number be between 5 and 15 characters - or likely 2 to 20, all<br>
> > numbers. A number of 156 characters is very likely to be a problem.<br>
> ><br>
><br>
> This is probably a stupid idea, because it could only be implemented in<br>
> trunk, and won't help with current implementations,<br>
> and I suggested it a long time ago already when I did the fast pattern<br>
> matching code, but I don't THINK it would be all that<br>
> hard to offer SOME regex syntax in patterns to help reduce the impact of<br>
> these kinds of problems.<br>
><br>
> Like using:<br>
><br>
> [incoming-from-voip]<br>
> exten => _X\{7-10\},1,Dial(${EXTEN}@incoming-from-voip-old)<br>
><br>
> instead of :<br>
><br>
> [incoming-from-voip]<br>
> exten => XXXXXXX,1,Dial(${EXTEN}@incoming-from-voip-old)<br>
> exten => XXXXXXXX,1,Dial(${EXTEN}@incoming-from-voip-old)<br>
> exten => XXXXXXXXX,1,Dial(${EXTEN}@incoming-from-voip-old)<br>
> exten => XXXXXXXXXX,1,Dial(${EXTEN}@incoming-from-voip-old)<br>
><br>
> I put the \'s in front of the {}'s because we probably wouldn't want to<br>
> change the<br>
> behavior of exact matching, and there's some precedent for using such stuff<br>
> in some implementations of regex, where \< matches the beginning of a word,<br>
> etc.<br>
><br>
> and, of course there would be the shorthand variants \{7-\} for seven or<br>
> more; \{-10\} for 1-10.<br>
> Some might argue 0-10. Whatever.<br>
><br>
> I THINK this could be implemented in both the fast pattern matcher and the<br>
> current slow one. I know it wouldn't be that bad to do in the fast pattern<br>
> matcher.<br>
> I hadn't really given the slow one (the current one) much thought.<br>
<br>
</div></div>I think it would be very useful. One small point:<br>
<br>
The '.' is short. This helps making it pupular. X\{1-\} is much less<br>
so.<br></blockquote><div><br>Very true, but the added syntax would not replace '.'. And they mean two<br>different things. X\{1-\} would mean one or more numbers, . means <br>any number of any character.<br><br>Heck, besides N\{2-4\}, Z\{3-7\}, I guess we could even do .\{2-100\}, which<br>
could mean 'match everything at the end of the string, but only if there's 2 to<br>100 of them', or something like that. Whatever is the most handy.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Another thing that I think would help: an equivalent of perl's \w:<br>
something similar to 'X', but also matches letters. This is syntactic<br>
sugar, but we need such sugar for readable dialplans.<br></blockquote><div><br>Could be done, but it ends up getting in the way of exact matching;<br>right now, using X,N,Z keeps you from exact matching those characters,<br>
(is there some escape mech in the syntax to let you say \NA\NCY? I <br>haven't checked). But, there's no reason we can't add other matching chars<br>for handy things. A = alpha chars Y = alphanum chars, G = Graphical chars,<br>
whatever. We just have to watch those backslashes, because if we use them as<br>an escape to mean literals in some situations, and as a notation to mean a<br>special function in others, then it starts getting confusing real quick.<br>
But all this kind of thing Could Be Done.<br><br>murf<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
--<br>
Tzafrir Cohen<br>
icq#16849755 <a href="mailto:jabber%3Atzafrir.cohen@xorcom.com">jabber:tzafrir.cohen@xorcom.com</a><br>
+972-50-7952406 mailto:<a href="mailto:tzafrir.cohen@xorcom.com">tzafrir.cohen@xorcom.com</a><br>
<a href="http://www.xorcom.com" target="_blank">http://www.xorcom.com</a> <a href="http://iax:guest@local.xorcom.com/tzafrir" target="_blank">iax:guest@local.xorcom.com/tzafrir</a><br>
<br>
--<br>
_____________________________________________________________________<br>
</div><div><div></div><div class="h5">-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Steve Murphy<br>ParseTree Corp<br><br>