Skip to content

Commit

Permalink
fix uncomment_regex
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasmhughes authored and Megan Wilhite committed May 18, 2022
1 parent 0ede62d commit 391abc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion salt/states/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -6062,7 +6062,7 @@ def comment(name, regex, char="#", backup=".bak", ignore_missing=False):
# remove (?i)-like flags, ^ and $
unanchor_regex = re.sub(r"^(\(\?[iLmsux]\))?\^?(.*?)\$?$", r"\2", regex)

uncomment_regex = "[^{}]?".format(char) + unanchor_regex
uncomment_regex = "^(?!.*{}).*".format(char) + unanchor_regex
comment_regex = char + unanchor_regex

# Make sure the pattern appears in the file before continuing
Expand Down

0 comments on commit 391abc9

Please sign in to comment.