mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
regex: bug fix about \w \W backslash chars (#11176)
This commit is contained in:
parent
b72d1e5e86
commit
fb3671107e
@ -90,8 +90,8 @@ For example `\w` is the meta-char `w`.
|
||||
|
||||
A meta-char can match different types of characters.
|
||||
|
||||
* `\w` matches an alphanumeric char `[a-zA-Z0-9_]`
|
||||
* `\W` matches a non alphanumeric char
|
||||
* `\w` matches a word char char `[a-zA-Z0-9_]`
|
||||
* `\W` matches a non word char
|
||||
* `\d` matches a digit `[0-9]`
|
||||
* `\D` matches a non digit
|
||||
* `\s` matches a space char, one of `[' ','\t','\n','\r','\v','\f']`
|
||||
|
@ -127,7 +127,7 @@ fn is_alnum(in_char byte) bool {
|
||||
if tmp <= 9 {
|
||||
return true
|
||||
}
|
||||
if tmp == `_` {
|
||||
if in_char == `_` {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -159,6 +159,7 @@ fn is_not_digit(in_char byte) bool {
|
||||
return !is_digit(in_char)
|
||||
}
|
||||
|
||||
/*
|
||||
[inline]
|
||||
fn is_wordchar(in_char byte) bool {
|
||||
return is_alnum(in_char) || in_char == `_`
|
||||
@ -168,6 +169,7 @@ fn is_wordchar(in_char byte) bool {
|
||||
fn is_not_wordchar(in_char byte) bool {
|
||||
return !is_alnum(in_char)
|
||||
}
|
||||
*/
|
||||
|
||||
[inline]
|
||||
fn is_lower(in_char byte) bool {
|
||||
|
@ -19,7 +19,7 @@ match_test_suite = [
|
||||
TestItem{"d.def",r"abc.\.[\w\-]{,100}",-1,0},
|
||||
TestItem{"abc12345.asd",r"abc.\.[\w\-]{,100}",-1,0},
|
||||
TestItem{"abca.exe",r"abc.\.[\w\-]{,100}",0,8},
|
||||
TestItem{"abc2.exe-test_12",r"abc.\.[\w\-]{,100}",0,13},
|
||||
TestItem{"abc2.exe-test_12",r"abc.\.[\w\-]{,100}",0,16},
|
||||
TestItem{"abcdefGHK",r"[a-f]+\A+",0,9},
|
||||
TestItem{"ab-cd-efGHK",r"[a-f\-g]+\A+",0,11},
|
||||
|
||||
@ -138,6 +138,8 @@ match_test_suite = [
|
||||
// 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},
|
||||
TestItem{"p_p", r"\w+",0,3},
|
||||
TestItem{"p_é", r"\w+",0,2},
|
||||
|
||||
// Crazywulf tests (?:^|[()])(\d+)(*)(\d+)(?:$|[()])
|
||||
TestItem{"1*1", r"(\d+)([*])(\d+)",0,3},
|
||||
|
Loading…
Reference in New Issue
Block a user