Home Download Buy Blog Forum Support

Python Regex String Parser Bug

Python Regex String Parser Bug

Postby TkTech on Sat May 12, 2012 12:48 am

Heyo,

There's a bug in the string parser (but only for regex strings). This snippet is 100% valid Python, but causes all text after it to be highlighted incorrectly:

Code: Select all
year_r = re.compile(r"""
    (?:\(|\[|'|\s)      # Match any opening (, [, '
    (\d{2}|\d{4})       # Match any 2 or 4 digit number
    (?:\)|\]|$)         # Match any closing (, [, or whitespace, or string end
    """, re.VERBOSE)


Removing the r on """ causes it to highlight correctly.
TkTech
 
Posts: 1
Joined: Sat May 12, 2012 12:42 am

Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 18 guests