1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

regex: fix simple char match (#17701)

This commit is contained in:
Felipe Pena
2023-03-20 05:37:09 -03:00
committed by GitHub
parent 74eac1de4e
commit 17fe76368a
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,19 @@
import regex
fn test_complex_matching() {
tmp_text := r"[export:'something']
const (
some_const = [1114111, 127, 2047, 65535, 1114111]!
)
[export:'something_empty']
const (
empty_const = ()
)
"
query := r'\[export:\S+\]\sconst\s\(\s+\S+\s{3}=\s\('
mut re := regex.regex_opt(query) or { panic(err) }
mut a := re.find_all(tmp_text)
assert a == [86, 138]
}