Merge pull request #27358 from lorengordon/escape-search-replacement-text

Escape search replacement text, fixes #27356
This commit is contained in:
C. R. Oldham 2015-09-24 07:52:46 -06:00
commit 5a3be10a3e

View file

@ -1441,7 +1441,7 @@ def replace(path,
if prepend_if_not_found or append_if_not_found:
# Search for content, so we don't continue pre/appending
# the content if it's been pre/appended in a previous run.
if re.search('^{0}$'.format(content), line):
if re.search('^{0}$'.format(re.escape(content)), line):
# Content was found, so set found.
found = True