regexp help

Iuri iurisilvio at gmail.com
Thu Aug 27 20:28:09 CEST 2009


You can use r"[+-]?\d+" to get positive and negative integers.

It returns true to these strings: "+123", "-123", "123"



On Thu, Aug 27, 2009 at 3:15 PM, Bakes <bakes at ymail.com> wrote:

> If I were using the code:
>
> (?P<data>[0-9]+)
>
> to get an integer between 0 and 9, how would I allow it to register
> negative integers as well?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090827/28aca218/attachment.html>


More information about the Python-list mailing list