Am Dienstag 02 Mai 2006 23:34 schrieb Fredrik Lundh:
> Heiko Wundram wrote:
> > As always, use a raw string for regular expressions. \d is being
> > interpreted to mean an ascii character, and not to mean the character
> > class you're trying to reference here.
>
> \d isn't an ASCII character, but
Heiko Wundram wrote:
> As always, use a raw string for regular expressions. \d is being interpreted
> to mean an ascii character, and not to mean the character class you're trying
> to reference here.
\d isn't an ASCII character, but \1 is.
>>> print '(\d{2})/\1/\1\1'
(\d{2})/?/??
--
http:
Am Dienstag 02 Mai 2006 23:23 schrieb Fredrik Lundh:
> Gary Wessle wrote:
> > regular expression match: what went wrong?
> (insert obligatory jwz quote here)
QOTW! :-D
--- Heiko.
--
http://mail.python.org/mailman/listinfo/python-list
Gary Wessle:
>tx = "now 04/30/2006 then"
>data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE)
>d = data.search(tx)
>print d
>
>Nono
>I was expecting 04/30/2006
You should expect: NameError: name 're' is not defined
> what went wrong?
\1 matches the content of the first group, which is '04'. It d
Am Dienstag 02 Mai 2006 23:06 schrieb Gary Wessle:
> Hi
>
> I am having an issue with this match
>
> tx = "now 04/30/2006 then"
> data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE)
As always, use a raw string for regular expressions. \d is being interpreted
to mean an ascii character, and not to
Gary Wessle wrote:
> I am having an issue with this match
>
> tx = "now 04/30/2006 then"
> data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE)
> d = data.search(tx)
> print d
>
> Nono
> I was expecting 04/30/2006
really? your pattern matches two digits, followed by a slash, followed
by a byte wi
Hi
I am having an issue with this match
tx = "now 04/30/2006 then"
data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE)
d = data.search(tx)
print d
Nono
I was expecting 04/30/2006, what went wrong?
thanks
--
http://mail.python.org/mailman/listinfo/python-list