Renamed 'findAllMatchesHelper' to 'findAllSubmatchHelper'
This commit is contained in:
@@ -168,7 +168,7 @@ func FindNthMatch(regex Reg, str string, n int) (Match, error) {
|
|||||||
var matchFound bool
|
var matchFound bool
|
||||||
var matchIdx Match
|
var matchIdx Match
|
||||||
for idx <= len(str_runes) {
|
for idx <= len(str_runes) {
|
||||||
matchFound, matchIdx, idx = findAllMatchesHelper(regex.start, str_runes, idx, regex.numGroups)
|
matchFound, matchIdx, idx = findAllSubmatchHelper(regex.start, str_runes, idx, regex.numGroups)
|
||||||
if matchFound {
|
if matchFound {
|
||||||
matchNum++
|
matchNum++
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ func (regex Reg) FindAllSubmatch(str string) []Match {
|
|||||||
var matchIdx Match
|
var matchIdx Match
|
||||||
indices := make([]Match, 0)
|
indices := make([]Match, 0)
|
||||||
for idx <= len(str_runes) {
|
for idx <= len(str_runes) {
|
||||||
matchFound, matchIdx, idx = findAllMatchesHelper(regex.start, str_runes, idx, regex.numGroups)
|
matchFound, matchIdx, idx = findAllSubmatchHelper(regex.start, str_runes, idx, regex.numGroups)
|
||||||
if matchFound {
|
if matchFound {
|
||||||
indices = append(indices, matchIdx)
|
indices = append(indices, matchIdx)
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ func (regex Reg) FindAllSubmatch(str string) []Match {
|
|||||||
// the next search should start from.
|
// the next search should start from.
|
||||||
//
|
//
|
||||||
// Might return duplicates or overlapping indices, so care must be taken to prune the resulting array.
|
// Might return duplicates or overlapping indices, so care must be taken to prune the resulting array.
|
||||||
func findAllMatchesHelper(start *nfaState, str []rune, offset int, numGroups int) (bool, Match, int) {
|
func findAllSubmatchHelper(start *nfaState, str []rune, offset int, numGroups int) (bool, Match, int) {
|
||||||
// Base case - exit if offset exceeds string's length
|
// Base case - exit if offset exceeds string's length
|
||||||
if offset > len(str) {
|
if offset > len(str) {
|
||||||
// The second value here shouldn't be used, because we should exit when the third return value is > than len(str)
|
// The second value here shouldn't be used, because we should exit when the third return value is > than len(str)
|
||||||
|
Reference in New Issue
Block a user