<br><div class="gmail_quote">On Mon, Oct 10, 2011 at 9:20 PM, Toyima Dias <span dir="ltr"><<a href="mailto:toyimads@gmail.com">toyimads@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font face="verdana,sans-serif">sorry, the range is 31297 - 31336...<br></font><div><div></div><div class="h5"><br><div class="gmail_quote">2011/10/10 Toyima Dias <span dir="ltr"><<a href="mailto:toyimads@gmail.com" target="_blank">toyimads@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><span style="color:rgb(0, 0, 0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;white-space:normal;border-collapse:separate"><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"></span></span>Hello, <br>
<br>i would like some help on a regular expression using dialplan module and regular expressions...this is what i want:<br><br>construct a regular expression for the following range: 31297-313336...i heve this simple string ^31[2-3]....the problem is the range from 97 to 36...any help please?<br>
</div></blockquote></div></div></div></blockquote><div><br>I don't know if there is a simpler way. <br>Here' it what i would use:<br><br>^(3129[789]|313([0-2][0-9]|3[0-6]))$<br><br>Test with this:<br><br>#!/usr/bin/python<br>
import re<br>r = re.compile("^(3129[789]|313([0-2][0-9]|3[0-6]))$")<br>count = 0<br>for i in range(100000):<br> if r.match(str(i)):<br> count = count + 1<br>print "Expected: " + str(31336 - 31296)<br>
print "Result: " + str(count)<br><br>regards,<br>Takeshi <br><br></div></div><br>