Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Fri, 2010-11-26 at 11:59 +0530, Dhananjay Nene wrote: > For a generic scheme > http://en.wikipedia.org/wiki/Telephone_numbers_in_India as already noted, this article is inaccurate. For example 'two tier cities have a 3 digit code' - I can point out villages that have 3 digit codes. > > But I c

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Dhananjay Nene
On Fri, Nov 26, 2010 at 11:59 AM, Dhananjay Nene wrote: > > > On Fri, Nov 26, 2010 at 11:40 AM, Kenneth Gonsalves wrote: > >> On Fri, 2010-11-26 at 11:30 +0530, Mandar Vaze / मंदार वझे wrote: >> > look at >> > http://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India >> > (But kenneth may h

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Dhananjay Nene
On Fri, Nov 26, 2010 at 11:40 AM, Kenneth Gonsalves wrote: > On Fri, 2010-11-26 at 11:30 +0530, Mandar Vaze / मंदार वझे wrote: > > look at > > http://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India > > (But kenneth may have already looked at this) > > no, I had not looked at this - I was

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Fri, 2010-11-26 at 11:30 +0530, Mandar Vaze / मंदार वझे wrote: > look at > http://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India > (But kenneth may have already looked at this) no, I had not looked at this - I was not looking for the mobile scheme which is fairly simple. -- regards

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Fri, 2010-11-26 at 11:23 +0530, Ramdas S wrote: > Would appreciate if you can tell whether you want a Regex, or is this > to > ensure that people enter the right numbers in a form? regex - for django.contrib.localflavor (I had put something up, but it only matches my local phone number, so I h

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Fri, 2010-11-26 at 09:03 +0530, Dhananjay Nene wrote: > So all one really needs to do (say if one wants to call back) is to > extract > one single 10 digit number using the above logic by stripping off the > optional prefixes and the extra characters (which I presume would be > quite > trivial).

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Mandar Vaze / मंदार वझे
> So all one really needs to do (say if one wants to call back) is to extract > one single 10 digit number using the above logic by stripping off the > optional prefixes and the extra characters (which I presume would be quite > trivial). But then maybe my mind is not working well today early morni

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Fri, 2010-11-26 at 07:56 +0530, steve wrote: > I had a bit of time this morning and didn't feel like starting work > just yet, so > to amuse myself I completed this. strangely enough that is how I got into this problem > Here is the proper regex ...with tests ! > > http://pastebin.com/yjP5H

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Ramdas S
On Fri, Nov 26, 2010 at 11:15 AM, Kenneth Gonsalves wrote: > On Thu, 2010-11-25 at 18:25 +0530, Mandar Vaze / मंदार वझे wrote: > > > please give me *some* credit for ability to search - those articles > > are > > > wildly inaccurate. > > > > > > > Did you mean "out dated" ? > > Feel free to share

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Thu, 2010-11-25 at 18:25 +0530, Mandar Vaze / मंदार वझे wrote: > > please give me *some* credit for ability to search - those articles > are > > wildly inaccurate. > > > > Did you mean "out dated" ? > Feel free to share the accurate information source (if it is not > confidential) I am crowd

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Navin Kabra
On Fri, Nov 26, 2010 at 9:03 AM, Dhananjay Nene wrote: > Thus there could be the optional prefixes +91 or 0 followed by an > additional > sequence of numbers which may have embedded some spaces, hyphens or in rare > cases parenthesis which are quite ignorable. > > So all one really needs to do (sa

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Dhananjay Nene
On Thu, Nov 25, 2010 at 3:11 PM, Kenneth Gonsalves wrote: > hi, > > on looking at the telephone book, Indian landline numbers have three > forms > > 3 digit STD code followed by 8 digits > 4 digit STD code followed by 7 digits > 5 digit STD code followed by 6 digits > > the first digit of the STD

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Roshan Mathews
On Fri, Nov 26, 2010 at 07:56, steve wrote: > I had a bit of time this morning and didn't feel like starting work just > yet, so to amuse myself I completed this. Here is the proper regex ...with > tests ! > > http://pastebin.com/yjP5H0i2 Neat. -- http://about.me/rosh __

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread steve
On 11/25/2010 06:45 PM, steve wrote: On 11/25/2010 04:10 PM, Kenneth Gonsalves wrote: On Thu, 2010-11-25 at 15:56 +0530, Anand Balachandran Pillai wrote: > r'(^0\d{2}[-\s]{1}[1-6]{1}\d{7})|(^0\d{3}[-\s]{1}[1-6]{1}\d{6})|(^0 > \d{4}[-\s]{1}[1-6]{1}\d{5})' > It is doable, but you sh

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread steve
On 11/25/2010 04:10 PM, Kenneth Gonsalves wrote: On Thu, 2010-11-25 at 15:56 +0530, Anand Balachandran Pillai wrote: > r'(^0\d{2}[-\s]{1}[1-6]{1}\d{7})|(^0\d{3}[-\s]{1}[1-6]{1}\d{6})|(^0 > \d{4}[-\s]{1}[1-6]{1}\d{5})' > It is doable, but you should really use pyparsing for this - this is

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Mandar Vaze / मंदार वझे
On Thu, Nov 25, 2010 at 4:08 PM, Kenneth Gonsalves wrote: > On Thu, 2010-11-25 at 15:55 +0530, Mandar Vaze / मंदार वझे wrote: > > > And any info as to whether my > > > assumptions as to the landline numbers is correct? > > > > > > > Check http://en.wikipedia.org/wiki/India_phone_code and > > http:

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Roshan Mathews
On Thu, Nov 25, 2010 at 15:11, Kenneth Gonsalves wrote: > r'(^0\d{2}[-\s]{1}[1-6]{1}\d{7})|(^0\d{3}[-\s]{1}[1-6]{1}\d{6})|(^0 > \d{4}[-\s]{1}[1-6]{1}\d{5})' > > any clues on how to make it shorter? The {1}s are redundant. -- http://about.me/rosh ___ B

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Anand Balachandran Pillai
On Thu, Nov 25, 2010 at 3:11 PM, Kenneth Gonsalves wrote: > hi, > > on looking at the telephone book, Indian landline numbers have three > forms > > 3 digit STD code followed by 8 digits > 4 digit STD code followed by 7 digits > 5 digit STD code followed by 6 digits > > the first digit of the STD

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Thu, 2010-11-25 at 16:40 +0530, devjyoti patra wrote: > This is a beautification attempt towards KG's regex > > (^0[\d]+)[-\s]{1}([1-6]{1}[\d]{5,7}) 0423678 244667 < not a valid number but your regex accepts it -- regards Kenneth Gonsalves _

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread devjyoti patra
This is a beautification attempt towards KG's regex (^0[\d]+)[-\s]{1}([1-6]{1}[\d]{5,7}) ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Thu, 2010-11-25 at 16:17 +0530, Lakshman Prasad wrote: > Rather than flexing the regex to everything it *can do*, I'd do the > following: > > * Capture 2 parts of the number separated by a "-" or a > whitespace: /^(\d+)[ > \-]+(\d+)$/ > * Use the captured parts to verify the lengths etc, using

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Lakshman Prasad
Rather than flexing the regex to everything it *can do*, I'd do the following: * Capture 2 parts of the number separated by a "-" or a whitespace: /^(\d+)[ \-]+(\d+)$/ * Use the captured parts to verify the lengths etc, using simple normal python. On Thu, Nov 25, 2010 at 4:11 PM, Kenneth Gonsalve

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Thu, 2010-11-25 at 16:06 +0530, Ramdas S wrote: > > It is doable, but you should really use pyparsing for this - this is > UGLY ! > > :) > > Meanwhile, let me hack on it. > > > > Regex is ugly. I guess Kenneth being django guy wants to use the > RegexField > in django forms where do I send th

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Thu, 2010-11-25 at 15:56 +0530, Anand Balachandran Pillai wrote: > > r'(^0\d{2}[-\s]{1}[1-6]{1}\d{7})|(^0\d{3}[-\s]{1}[1-6]{1}\d{6})|(^0 > > \d{4}[-\s]{1}[1-6]{1}\d{5})' > > > > It is doable, but you should really use pyparsing for this - this is > UGLY ! I know - but everything I tried to ma

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Thu, 2010-11-25 at 15:55 +0530, Mandar Vaze / मंदार वझे wrote: > > And any info as to whether my > > assumptions as to the landline numbers is correct? > > > > Check http://en.wikipedia.org/wiki/India_phone_code and > http://en.wikipedia.org/wiki/Telephone_numbers_in_India to get > additional >

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Ramdas S
On Thu, Nov 25, 2010 at 3:56 PM, Anand Balachandran Pillai < abpil...@gmail.com> wrote: > On Thu, Nov 25, 2010 at 3:11 PM, Kenneth Gonsalves >wrote: > > > hi, > > > > on looking at the telephone book, Indian landline numbers have three > > forms > > > > 3 digit STD code followed by 8 digits > > 4

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Anand Balachandran Pillai
On Thu, Nov 25, 2010 at 3:11 PM, Kenneth Gonsalves wrote: > hi, > > on looking at the telephone book, Indian landline numbers have three > forms > > 3 digit STD code followed by 8 digits > 4 digit STD code followed by 7 digits > 5 digit STD code followed by 6 digits > > the first digit of the STD

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Mandar Vaze / मंदार वझे
> And any info as to whether my > assumptions as to the landline numbers is correct? > Check http://en.wikipedia.org/wiki/India_phone_code and http://en.wikipedia.org/wiki/Telephone_numbers_in_India to get additional info. These two URLs also have link to some PDFs from DoT -Mandar __

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
On Thu, 2010-11-25 at 15:32 +0530, Noufal Ibrahim wrote: > > r'(^0\d{2}[-\s]{1}[1-6]{1}\d{7})|(^0\d{3}[-\s]{1}[1-6]{1}\d{6})|(^0 > > \d{4}[-\s]{1}[1-6]{1}\d{5})' > > > > any clues on how to make it shorter? And any info as to whether my > > assumptions as to the landline numbers is correct? > > Th

Re: [BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Noufal Ibrahim
On Thu, Nov 25 2010, Kenneth Gonsalves wrote: > hi, > > on looking at the telephone book, Indian landline numbers have three > forms > > 3 digit STD code followed by 8 digits > 4 digit STD code followed by 7 digits > 5 digit STD code followed by 6 digits > > the first digit of the STD code has to

[BangPypers] regular expression for Indian landline numbers

2010-11-25 Thread Kenneth Gonsalves
hi, on looking at the telephone book, Indian landline numbers have three forms 3 digit STD code followed by 8 digits 4 digit STD code followed by 7 digits 5 digit STD code followed by 6 digits the first digit of the STD code has to be 0. The first digit of the landline number starts from 1-6. Of