Question about raw string and regex
John Machin
sjmachin at lexicon.net
Thu Mar 23 21:10:26 EST 2006
On 24/03/2006 12:36 PM, jlowery at blarg.net wrote:
> I doubt it, although it might work anyway.
You could dispel all doubt in about 15 seconds flat were you to actually
try it out.
>>> import regex
__main__:1: DeprecationWarning: the regex module is deprecated; please
use the re module
>>> regex.match(r"[ \t]", "\t")
-1
>>> regex.match("[ \t]", "\t")
1
>>> import re
>>> re.match("[ \t]", "\t")
<_sre.SRE_Match object at 0x00AE9058>
>>> re.match(r"[ \t]", "\t")
<_sre.SRE_Match object at 0x00AE9918>
>>>
>
> Here's another from the same program:
>
> (a0, b0), (a1, b1), (a2, b2) = classprog.regs[:3]
>
> Nothing in the Python lib reference on the regs attribute for regex
> objects.
>
Dunno where you're looking, but my Python 1.5.2 has the regex docs,
which include a big fat note to the effect of the above
DeprecationWarning, plus documentation on the regs attribute.
More information about the Python-list
mailing list