Add escape characters and control characters

This commit is contained in:
miloyip
2015-05-27 09:37:55 +08:00
parent 1784afe5f7
commit 92285bed44
2 changed files with 40 additions and 1 deletions

View File

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