View Single Post
Join Date: Mar 2007
Posts: 110
Reputation: solsteel is on a distinguished road 
Solved Threads: 31
solsteel solsteel is offline Offline
Junior Poster

Re: Regex for re.match not working as expected.

 
0
  #2
Oct 9th, 2008
The substring "\t" in string is evaluated as a tab character. The re method match only matches at the beginning of a string. Try this:
  1. import re
  2. s = r'c:\test.doc'
  3. m = re.search(r":(\\[0-9a-z])", s)
  4. if m:
  5. print m.group(1)
  6. else:
  7. print m
Reply With Quote