mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
regex: fix for last group with OR inside (#16324)
This commit is contained in:
parent
fd4045931a
commit
eb0c46e13a
2 changed files with 12 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue