> p = re.compile(r'[A-Za-z]:\\([^/:\*?"<>\|])*')
> 
> x = p.match("c:\test")

> any ideas why?  i escape the back-slash, the asterisk *, and the PIPE |
> ....b/c they are regex special characters.


Same problem, only now in the other string:

 >>> s = "c:\test"
 >>> print s
c:      est

Your "\t" is interpreted as as tab character.  Thus, you want

        s = r"c:\test"

or

        s = "c:\\test"

which you'll find should now be successfully found with

        p.match(s)

-tkc




-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to