I’m not sure why this regex will not compile in python 2.7 (re.compile). The re.debug flag won’t even show me why.
\b(?<case>(review|case|bug[zs]?(\s| )*(id)?:?)s?(\s| )*([#:; ]| )+)((([ ,:;#]|and)*)(?<bugid>\d+))+
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because in Python, named captures are done with
(?P<name>), not(?<name>). Try:Be sure to also use a raw string, e.g.
r'regex'(which compares with C#’s@"regex"syntax).Note that
(\s| )is redundant, and can be replaced with(\s)or simply\sif the capture is not important. Similarly,([#:; ]| )can be safely replaced with([#:; ]).