mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
regex: fix for last group with OR inside (#16324)
This commit is contained in:
parent
fd4045931a
commit
eb0c46e13a
@ -1931,6 +1931,12 @@ pub fn (mut re RE) match_base(in_txt &u8, in_txt_len int) (int, int) {
|
||||
}
|
||||
|
||||
// println("No good exit!!")
|
||||
if re.prog[re.prog_len - 1].ist == regex.ist_group_end {
|
||||
// println("last ist is a group end!")
|
||||
if re.prog[re.prog_len - 1].group_rep >= re.prog[re.prog_len - 1].rep_min {
|
||||
return state.first_match, state.i
|
||||
}
|
||||
}
|
||||
return regex.no_match_found, state.i
|
||||
}
|
||||
|
||||
|
@ -376,6 +376,12 @@ find_all_test_suite = [
|
||||
r"([^\n]*)",
|
||||
[0, 2],
|
||||
['ab']
|
||||
},
|
||||
Test_find_all{
|
||||
"ab",
|
||||
r"([^\n]|a)*",
|
||||
[0, 2],
|
||||
['ab']
|
||||
}
|
||||
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user