diff --git a/cmd/tools/vcheck-md.v b/cmd/tools/vcheck-md.v index 4b042e0108..f5cd5eae21 100644 --- a/cmd/tools/vcheck-md.v +++ b/cmd/tools/vcheck-md.v @@ -292,7 +292,7 @@ fn (mut ad AnchorData) add_link_targets(line_number int, line string) { } } } else { - query := r'[a-z0-9\-\_\x7f-\uffff]+)["\']\s*/>' + query := '[a-z0-9\\-\\_\\x7f-\\uffff]+)["\']\\s*/>' mut re := regex.regex_opt(query) or { panic(err) } res := re.find_all_str(line) diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index b60deb9700..b9ff59629d 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -1126,7 +1126,8 @@ fn (mut s Scanner) ident_string() string { c := s.text[s.pos] prevc := s.text[s.pos - 1] // end of string - if c == s.quote && (prevc != slash || (prevc == slash && s.text[s.pos - 2] == slash)) { + if c == s.quote + && (is_raw || prevc != slash || (prevc == slash && s.text[s.pos - 2] == slash)) { // handle '123\\' slash at the end break } diff --git a/vlib/v/tests/raw_string_test.v b/vlib/v/tests/raw_string_test.v new file mode 100644 index 0000000000..762d532ff2 --- /dev/null +++ b/vlib/v/tests/raw_string_test.v @@ -0,0 +1,3 @@ +fn test_raw_string_backslash() { + assert r'\' == r'\' +}