diff --git a/vlib/regex/regex.v b/vlib/regex/regex.v index 8788ea0851..7023204303 100644 --- a/vlib/regex/regex.v +++ b/vlib/regex/regex.v @@ -393,7 +393,7 @@ const( ] // these chars are escape if preceded by a \ - bsls_escape_list = [`\\`, `|`, `.`, `*`, `+`, `-`, `{`, `}`, `[`, `]`] + bsls_escape_list = [`\\`, `|`, `.`, `:`, `*`, `+`, `-`, `{`, `}`, `[`, `]`, `(`, `)`, `?`] ) enum BSLS_parse_state { diff --git a/vlib/regex/regex_test.v b/vlib/regex/regex_test.v index b58f7d2196..4800d09fa1 100644 --- a/vlib/regex/regex_test.v +++ b/vlib/regex/regex_test.v @@ -119,6 +119,11 @@ match_test_suite = [ TestItem{"accccb deer", r"^a(.*)b d(.+)",0,11}, TestItem{"accccb deer", r"^(.*)$",0,11}, TestItem{"accccb deer", r"^a(.*)b d(.+)p",-1,0}, + + // test bcksls chars + TestItem{"[ an s. s! ]( wi4ki:something )", r"\[.*\]\( *(\w*:*\w+) *\)",0,31}, + TestItem{"[ an s. s! ](wiki:something)", r"\[.*\]\( *(\w*:*\w+) *\)",0,28}, + ] )