[BangPypers] regular expression for Indian landline numbers

Lakshman Prasad scorpion032 at gmail.com
Thu Nov 25 11:47:59 CET 2010


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 Gonsalves <lawgon at au-kbc.org>wrote:

> 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 at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list