SedRegex: fix some replacement queries not working

From: 926454b01d
This commit is contained in:
James Lu 2017-01-04 20:36:45 -08:00
parent 6445e90ec7
commit 90ec8a6976

View File

@ -49,7 +49,7 @@ except ImportError:
# lower than 2.7.6: see https://stackoverflow.com/questions/3675144/regex-error-nothing-to-repeat # lower than 2.7.6: see https://stackoverflow.com/questions/3675144/regex-error-nothing-to-repeat
# and https://bugs.python.org/issue18647 # and https://bugs.python.org/issue18647
SED_REGEX = re.compile(r"^(?:(?P<nick>.+?)[:,] )?s(?P<delim>[^\w\s])(?P<pattern>.*?)(?P=delim)" SED_REGEX = re.compile(r"^(?:(?P<nick>.+?)[:,] )?s(?P<delim>[^\w\s])(?P<pattern>.*?)(?P=delim)"
r"(?P<replacement>.*?)(?P=delim)(?P<flags>[a-z]{0,3})?$") r"(?P<replacement>.*?)(?P=delim)(?P<flags>[a-z]{0,3})$")
# Replace newlines and friends with things like literal "\n" (backslash and "n") # Replace newlines and friends with things like literal "\n" (backslash and "n")
axe_spaces = utils.str.MultipleReplacer({'\n': '\\n', '\t': '\\t', '\r': '\\r'}) axe_spaces = utils.str.MultipleReplacer({'\n': '\\n', '\t': '\\t', '\r': '\\r'})