Re: [BangPypers] regular expression for Indian landline numbers
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 be 0. The first digit of the landline number starts from 1-6. Of course I am not dead sure of the starting numbers, but I have seen mobile numbers starting with 9 and 8, and I think 7 is also reserved for mobile. I could not find any authorative info on this. This is the re: 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? This is the Python list. Not Perl. :) But anyway, I've noticed that many people mention land line numbers similar to the way cell phones specify numbers. ie. +9180 (ISD-code, STD-code and the rest) so that might be a case you'd have to capture as well. -- ~noufal http://nibrahim.net.in ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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? This is the Python list. Not Perl. :) huh? I do not see any perl in my post -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Thu, Nov 25, 2010 at 3:11 PM, Kenneth Gonsalves law...@au-kbc.orgwrote: 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 course I am not dead sure of the starting numbers, but I have seen mobile numbers starting with 9 and 8, and I think 7 is also reserved for mobile. I could not find any authorative info on this. This is the re: 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 ! :) Meanwhile, let me hack on it. any clues on how to make it shorter? And any info as to whether my assumptions as to the landline numbers is correct? -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 law...@au-kbc.org 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 be 0. The first digit of the landline number starts from 1-6. Of course I am not dead sure of the starting numbers, but I have seen mobile numbers starting with 9 and 8, and I think 7 is also reserved for mobile. I could not find any authorative info on this. This is the re: 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 ! :) Meanwhile, let me hack on it. Regex is ugly. I guess Kenneth being django guy wants to use the RegexField in django forms any clues on how to make it shorter? And any info as to whether my assumptions as to the landline numbers is correct? -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- Ramdas S +91 9342 583 065 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 info. These two URLs also have link to some PDFs from DoT please give me *some* credit for ability to search - those articles are wildly inaccurate. -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 make it look good did not work. And the app in which I am plugging this into requires an re. -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 the coconut? -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 simple normal python. sure - I can think of several ways to do this, but as explained, I need a regex. -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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
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 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Thu, Nov 25, 2010 at 3:11 PM, Kenneth Gonsalves law...@au-kbc.orgwrote: 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 course I am not dead sure of the starting numbers, but I have seen mobile numbers starting with 9 and 8, and I think 7 is also reserved for mobile. I could not find any authorative info on this. This is the re: 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? Your regex is complicated because you are putting all rules into a single regex. There are different ways to make this shorter. The best option according to me is to define two regexes, one for the STD code part and the other for the number part. So in this case, it will be like, std=re.compile(r'(^0\d{2,4})') num=re.compile(r'([1-6]{1}\d{6,8})') number='080-25936609' Find out the lengths of the std and number parts. l1=len(std.findall(number.split('-')[0])[0]) l1 3 l2=len(num.findall(number.split('-')[1])[0]) l2 8 And do the rest in code. If (((l1==3) and (l2==8)) or ... ): print 'valid number' else: print 'invalid number' The second option which I don't favor is to split the rule into 3 regexes instead of ORing them together and then do a simple OR in code. r1=re.compile(r'(^0\d{2}[-\s]{1}[1-6]{1}\d{7})') r2=re.compile(r'(^0\d{3}[-\s]{1}[1-6]{1}\d{6})') r3=re.compile(r'(^0\d{4}[-\s]{1}[1-6]{1}\d{5})') Then of course, if (r1.match(num) or r2.match(num) or r3.match(num)): print 'valid' else: print 'invalid' If you can't use *any* code and absolutely has to do this directly in regex, revert back to your original one. There is no other way to do this using the re module. --Anand -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- --Anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Thu, Nov 25, 2010 at 15:11, Kenneth Gonsalves law...@au-kbc.org 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 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Thu, Nov 25, 2010 at 4:08 PM, Kenneth Gonsalves law...@au-kbc.orgwrote: 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 info. These two URLs also have link to some PDFs from DoT 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) -Mandar ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 UGLY ! I know - but everything I tried to make it look good did not work. And the app in which I am plugging this into requires an re. Certainly, you can beautify that using the verbose option. Here is my attempt. (Note, I use the beautiful (?(id/name)yes-pattern|no-pattern) syntax for the black magic :) phone_re = re.compile(r (^0 # all std-codes start with 0 ( (?Ptwodigit\d{2}) | # the std-code group (?Pthreedigit\d{3}) | # either two, three or four digits (?Pfourdigit\d{4})# following the 0 ) [-\s] # space or - [1-6] # first digit of phone number ( (?(twodigit)\d{7}) | # 7 more phone digits for 3 digit stdcode (?(threedigit)\d{6}) | # 6 more phone digits for 4 digit stdcode (?(fourdigit)\d{5}) # 5 more phone digits for 5 digit stdcode ) )$, re.VERBOSE) hth, cheers, - steve ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 should really use pyparsing for this - this is UGLY ! I know - but everything I tried to make it look good did not work. And the app in which I am plugging this into requires an re. Certainly, you can beautify that using the verbose option. Here is my attempt. (Note, I use the beautiful (?(id/name)yes-pattern|no-pattern) syntax for the black magic :) 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 Basically, almost the same thing as I posted yesterday but with named groups for std-code and phone number. cheers, - steve ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Fri, Nov 26, 2010 at 07:56, steve st...@lonetwin.net 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 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Thu, Nov 25, 2010 at 3:11 PM, Kenneth Gonsalves law...@au-kbc.orgwrote: 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 course I am not dead sure of the starting numbers, but I have seen mobile numbers starting with 9 and 8, and I think 7 is also reserved for mobile. I could not find any authorative info on this. This is the re: 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? Not to take away the fun that so many are obviously having on this thread, but at least from a business perspective what generally matters (barring some rare exceptions) is that Indian phone numbers are all 10 digits. :) 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 (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 morning :) Dhananjay -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- blog: http://blog.dhananjaynene.com twitter: http://twitter.com/dnene ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Fri, Nov 26, 2010 at 9:03 AM, Dhananjay Nene dhananjay.n...@gmail.comwrote: 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 (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 morning :) This might be veering off from the original subject a bit, but since you brought it up, here's the code I use for extracting an Indian phone number from various different ways in which users might enter that...: http://pastebin.com/GRyLgePr No, it's not an regexp like Kenneth wants. But I've found this piece of code to be useful in a number of different contexts... ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 sourcing the info - and looking at the telephone directory. I am planning to drop in at the BSNL office also (but I doubt anyone will have a clue about it). -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Fri, Nov 26, 2010 at 11:15 AM, Kenneth Gonsalves law...@au-kbc.orgwrote: 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 sourcing the info - and looking at the telephone directory. I am planning to drop in at the BSNL office also (but I doubt anyone will have a clue about it). -- regards Kenneth Gonsalves Kenneth, 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? ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- Ramdas S +91 9342 583 065 ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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/yjP5H0i2 cool - of course negative tests have to be added - but that is no big deal -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 morning :) Kenneth's original email ( http://mail.python.org/pipermail/bangpypers/2010-November/005386.html) doesn' say whether he wishes to validate or extract. Depending on how far one wants to go - validation of phone number (depending on additional information one may have) can get very complex. e.g. If one needs to validate a landline telephone number for person staying in chhatisgadh - then a valid telephone number like 080-3033777 is NOT valid in this case since this number belongs to b'lore. Similarly for mobile numbers, not ALL 10 digit numbers starting with 9,8 or 7 are valid. Several 4 digit codes in 8xxx, and 7xxx are unallocated - hence invalid. look at http://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India (But kenneth may have already looked at this) So depending on how accurate the validation needs to be - this can be very interesting validation problem. One can always take simplistic view - if the requirements are fulfilled. -Mandar ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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). But then maybe my mind is not working well today early morning :) and how does one distinguish the STD code from the phone number? my std code is 4 digits and my phone number is 7 digits - but someone can assume that the std code is 3 digits and the phone number is 8 digits - and when he comes within my local area, he cannot phone me. That is why the STD code and the phone number *must* be separated by something, otherwise it is impossible to parse. -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 have to change it). btw, regex should not be used for validation (AFAIK). -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Fri, Nov 26, 2010 at 11:40 AM, Kenneth Gonsalves law...@au-kbc.orgwrote: 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. For a generic scheme http://en.wikipedia.org/wiki/Telephone_numbers_in_India But I couldn't find out any programmable pattern to identify how long is a STD code given a full number. Having said that, at least for most generic scenarios STD code is simply an indicator relic of how telephone exchanges work, in most cases an unimportant part of the full 10 digit number -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- blog: http://blog.dhananjaynene.com twitter: http://twitter.com/dnene ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
On Fri, Nov 26, 2010 at 11:59 AM, Dhananjay Nene dhananjay.n...@gmail.comwrote: On Fri, Nov 26, 2010 at 11:40 AM, Kenneth Gonsalves law...@au-kbc.orgwrote: 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. For a generic scheme http://en.wikipedia.org/wiki/Telephone_numbers_in_India But I couldn't find out any programmable pattern to identify how long is a STD code given a full number. Having said that, at least for most generic scenarios STD code is simply an indicator relic of how telephone exchanges work, in most cases an unimportant part of the full 10 digit number Here's another link which is quite topical : http://blog.stevenlevithan.com/archives/validate-phone-number regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers -- blog: http://blog.dhananjaynene.com twitter: http://twitter.com/dnene -- blog: http://blog.dhananjaynene.com twitter: http://twitter.com/dnene ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
Re: [BangPypers] regular expression for Indian landline numbers
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 couldn't find out any programmable pattern to identify how long is a STD code given a full number. Having said that, at least for most generic scenarios STD code is simply an indicator relic of how telephone exchanges work, in most cases an unimportant part of the full 10 digit number -- regards Kenneth Gonsalves ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers