Re: data regex match

2006-05-02 Thread Heiko Wundram
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

Re: data regex match

2006-05-02 Thread 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 \1 is. >>> print '(\d{2})/\1/\1\1' (\d{2})/?/?? -- http:

Re: data regex match

2006-05-02 Thread Heiko Wundram
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

Re: data regex match

2006-05-02 Thread Rene Pijlman
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

Re: data regex match

2006-05-02 Thread Heiko Wundram
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

Re: data regex match

2006-05-02 Thread Fredrik Lundh
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

data regex match

2006-05-02 Thread 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) 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