Add character class escapes

This commit is contained in:
miloyip
2015-05-27 09:56:06 +08:00
parent 92285bed44
commit 0dffe87551
2 changed files with 49 additions and 28 deletions

View File

@@ -328,10 +328,10 @@ TEST(Regex, CharacterRange8) {
}
TEST(Regex, Escape) {
const char* s = "\\|\\(\\)\\?\\*\\+\\.\\[\\]\\\\\\f\\n\\r\\t\\v";
const char* s = "\\|\\(\\)\\?\\*\\+\\.\\[\\]\\\\\\f\\n\\r\\t\\v[\\b][\\[][\\]]";
Regex re(s);
ASSERT_TRUE(re.IsValid());
EXPECT_TRUE(re.Match("|()?*+.[]\\\x0C\n\r\t\x0B"));
EXPECT_TRUE(re.Match("|()?*+.[]\\\x0C\n\r\t\x0B\b[]"));
EXPECT_FALSE(re.Match(s)); // Not escaping
}