Question about metacharacter '*'
python at mrabarnett.plus.com
Mon Jul 7 00:49:23 CEST 2014
On 2014-07-06 18:41, Albert-Jan Roskam wrote:
>>In article <d8f8d76d-0a47-4f59-8f09-da2a44cc1d2e at googlegroups.com>,
>> Rick Johnson <rantingrickjohnson at gmail.com> 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
>>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.
More information about the Python-list