1
0
Fork 0

use two simple regexes to workaround macos compilers producing endless loops (#9281)

This commit is contained in:
Wilfried Goesgens 2019-06-25 09:02:22 +02:00 committed by jsteemann
parent 48f9856e03
commit b7f933c260
1 changed files with 7 additions and 4 deletions

View File

@ -25,16 +25,19 @@
#include <regex>
namespace {
std::regex const removeComments("(^[ \t]+|[ \t]*(#.*)?$)", std::regex::nosubs | std::regex::ECMAScript);
std::regex const removeComments("#.*$", std::regex::ECMAScript);
std::regex const removeTabs("^[ \t]+|[ \t]+$", std::regex::ECMAScript);
}
namespace arangodb {
namespace options {
std::string removeCommentsFromNumber(std::string const& value) {
// replace leading spaces, replace trailing spaces & comments
return std::regex_replace(value, ::removeComments, "");
// replace trailing comments
auto noComment = std::regex_replace(value, ::removeComments, "");
// replace leading spaces, replace trailing spaces
return std::regex_replace(noComment, ::removeTabs, "");
}
}
}
}