Skip to content

Commit

Permalink
Added \e to escape characters in string literal.
Browse files Browse the repository at this point in the history
  • Loading branch information
nthnn committed Sep 20, 2024
1 parent 3dea6b0 commit 65402a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/util/StringUnescape.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace ZhivoUtil {

inline static std::string replaceEscapeSequences(const std::string& input) {
std::string::const_iterator searchStart(input.cbegin());
std::regex escapeRegex(R"(\\(n|r|t|a|b|v|f))");
std::regex escapeRegex(R"(\\(n|r|t|a|b|v|f|e))");
std::string result;
std::smatch match;

Expand All @@ -47,6 +47,8 @@ inline static std::string replaceEscapeSequences(const std::string& input) {
result.append("\v");
else if(match[1] == "f")
result.append("\f");
else if(match[1] == "e")
result.append("\u001b");

searchStart = match[0].second;
}
Expand Down

0 comments on commit 65402a6

Please sign in to comment.