I tried that in the re test program (Perl style-re tester) provided
with Pyton 2.4 and ... Ah, I used /. It works. But I also used \.
Well, I see the culprit. I had one too many \d in: dateRe =
re.compile(r'v\d\d\d\d\d\d\d\d_\d\d\d\d\d\d\.\d\d.*') Got it. Thanks. Kent Johnson wrote: On Tue, Sep 23, 2008 at 10:02 PM, Wayne Watson <[EMAIL PROTECTED]> wrote:How do I match a dot in, for example, abc.txt? I want to match it exactly. There must be some sort of escape.Assuming you want to match in a regular _expression_, use \ as an escape and use raw strings.In [40]: import re In [41]: m=re.search(r'\.', 'abc.de') In [43]: m.start() Out[43]: 3 Kent --
Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) "Truth is mighty and will prevail. There is nothing wrong with this, except that it ain't so." -- Mark Twain Web Page: <www.speckledwithstars.net/> |
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor