Skip to content

Commit

Permalink
Simplify regex for terminal color codes
Browse files Browse the repository at this point in the history
(cherry picked from commit 8ba3a30)
  • Loading branch information
MichaelHatherly committed Dec 30, 2016
1 parent b9c7335 commit 808ec29
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/DocChecks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,7 @@ end

# Remove terminal colors.

const TERM_COLOR_REGEX =
let _1 = map(escape_string, values(Base.text_colors)),
_2 = map(each -> replace(each, "[", "\\["), _1)
Regex(string("(\\e\\[31m|\\e\\[22m|", join(_2, "|"), ")"))
end

const TERM_COLOR_REGEX = r"\e\[[0-9;]*m"
remove_term_colors(s) = replace(s, TERM_COLOR_REGEX, "")

# REPL doctest splitter.
Expand Down

0 comments on commit 808ec29

Please sign in to comment.