The reason I did not use \d\d* or \d+ or ^\d+$ or any number of
more-correct things was because the OP was new to regexps.

-- Devin

On Sun, Jul 6, 2014 at 3:49 PM, MRAB <[email protected]> wrote:
> On 2014-07-06 18:41, Albert-Jan Roskam wrote:
>>
>>
>>
>>
>>> In article <[email protected]>,
>>> Rick Johnson <[email protected]> wrote:
>>>
>>>> As an aside i prefer to only utilize a "character set" when
>>>> nothing else will suffice. And in this case r"[0-9][0-9]*"
>>>> can be expressed just as correctly  (and less noisy IMHO) as
>>>> r"\d\d*".
>>>
>>>
>>> Even better, r"\d+"
>>
>>
>> I tend tot do that too, even though technically the two are not perfectly
>> equivalent. With the re.LOCALE flag LC_ctype is also affected, which affects
>> what is captured by \d but not by [0-9]
>>
> \d also matches more than just [0-9] in Unicode.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to