Thread
:
Regex for re.match not working as expected.
View Single Post
•
•
Join Date: Mar 2007
Posts: 110
Reputation:
Solved Threads: 31
solsteel
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:
Help with Code Tags
Python Syntax
(
Toggle Plain Text
)
import
re
s = r
'c:
\t
est.doc'
m =
re
.
search
(
r
":(
\\
[0-9a-z])"
, s
)
if
m:
print
m.
group
(
1
)
else
:
print
m
import re s = r'c:\test.doc' m = re.search(r":(\\[0-9a-z])", s) if m: print m.group(1) else: print m
solsteel
View Public Profile
Find all posts by solsteel