mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
regex: fix dot char problems on groups with * (#13333)
This commit is contained in:
parent
310969a057
commit
7c1b249da0
2 changed files with 10 additions and 0 deletions
|
@ -2024,6 +2024,11 @@ pub fn (mut re RE) match_base(in_txt &byte, in_txt_len int) (int, int) {
|
||||||
|
|
||||||
re.prog[state.pc].group_rep++ // increase repetitions
|
re.prog[state.pc].group_rep++ // increase repetitions
|
||||||
// println("GROUP $group_index END ${re.prog[state.pc].group_rep}")
|
// println("GROUP $group_index END ${re.prog[state.pc].group_rep}")
|
||||||
|
if re.prog[state.pc].group_rep > in_txt_len - 1 {
|
||||||
|
m_state = .ist_quant_ng
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
m_state = .ist_quant_pg
|
m_state = .ist_quant_pg
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,6 +160,11 @@ match_test_suite = [
|
||||||
TestItem{"a", r"\S+",0,1},
|
TestItem{"a", r"\S+",0,1},
|
||||||
TestItem{"aaaa", r"\S+",0,4},
|
TestItem{"aaaa", r"\S+",0,4},
|
||||||
TestItem{"aaaa ", r"\S+",0,4},
|
TestItem{"aaaa ", r"\S+",0,4},
|
||||||
|
|
||||||
|
// multiple dot char
|
||||||
|
TestItem{"aba", r"a*(b*)*a",0,3},
|
||||||
|
TestItem{"/*x*/", r"/\**(.*)\**/",0,5},
|
||||||
|
TestItem{"/*x*/", r"/*(.*)*/",0,5},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue