Implement PCRE Matching (prefer left-branch) #2
@@ -287,7 +287,9 @@ func findAllSubmatchHelper(start *nfaState, str []rune, offset int, numGroups in
|
||||
if currentState.isLast {
|
||||
currentState.threadGroups[0].EndIdx = idx
|
||||
match = append([]Group{}, currentState.threadGroups...)
|
||||
break
|
||||
if !preferLongest {
|
||||
break
|
||||
}
|
||||
} else if !currentState.isAlternation && !currentState.isKleene && !currentState.isQuestion && !currentState.groupBegin && !currentState.groupEnd && currentState.assert == noneAssert { // Normal character
|
||||
if currentState.contentContains(str, idx, preferLongest) {
|
||||
nextStates = addStateToList(str, idx+1, nextStates, *currentState.next, currentState.threadGroups, nil, preferLongest)
|
||||
|
Reference in New Issue
Block a user