Sublime Forum

Bug with python raw string regex highlighting square bracket

#1

If you enter one of the following in a python-highlighted file, the string closure is not recognised (so the remainder of the file is highlighted as in purple (that’s as regex characters I guess):

# a raw string with an open bracket:
r''

# this is a valid regex, but breaks the highlighting too...
r'\]]'

print "oh no! Where's the syntax highlighting?"

# ] this close bracket will turn the highlighting back on for subsequent text...
print "phew! The syntax highlighting has returned!"

Note that the second string is a valid regex that matches either a ‘’ or a ‘]’. This is the same for triple quoted raw strings.

0 Likes