Regex optional match in python fails
Posted
by AaronG
on Stack Overflow
See other posts from Stack Overflow
or by AaronG
Published on 2010-05-03T17:57:02Z
Indexed on
2010/05/03
18:08 UTC
Read the original article
Hit count: 337
tickettypepat = (r'MIS Notes:.**(//p//)?.**')
retype = re.search(tickettypepat,line)
if retype:
print retype.group(0)
print retype.group(1)
Given the input.
MIS Notes: //p//
Can anyone tell me why group(0) is
MIS Notes: //p//
and group(1) is returning as None?
© Stack Overflow or respective owner