if n < 0 {
n = len(b) + 1
}
- result := make([][]byte, 0, startSize)
+ var result [][]byte
re.allMatches("", b, n, func(match []int) {
+ if result == nil {
+ result = make([][]byte, 0, startSize)
+ }
result = append(result, b[match[0]:match[1]])
})
- if len(result) == 0 {
- return nil
- }
return result
}
if n < 0 {
n = len(b) + 1
}
- result := make([][]int, 0, startSize)
+ var result [][]int
re.allMatches("", b, n, func(match []int) {
+ if result == nil {
+ result = make([][]int, 0, startSize)
+ }
result = append(result, match[0:2])
})
- if len(result) == 0 {
- return nil
- }
return result
}
if n < 0 {
n = len(s) + 1
}
- result := make([]string, 0, startSize)
+ var result []string
re.allMatches(s, nil, n, func(match []int) {
+ if result == nil {
+ result = make([]string, 0, startSize)
+ }
result = append(result, s[match[0]:match[1]])
})
- if len(result) == 0 {
- return nil
- }
return result
}
if n < 0 {
n = len(s) + 1
}
- result := make([][]int, 0, startSize)
+ var result [][]int
re.allMatches(s, nil, n, func(match []int) {
+ if result == nil {
+ result = make([][]int, 0, startSize)
+ }
result = append(result, match[0:2])
})
- if len(result) == 0 {
- return nil
- }
return result
}
if n < 0 {
n = len(b) + 1
}
- result := make([][][]byte, 0, startSize)
+ var result [][][]byte
re.allMatches("", b, n, func(match []int) {
+ if result == nil {
+ result = make([][][]byte, 0, startSize)
+ }
slice := make([][]byte, len(match)/2)
for j := range slice {
if match[2*j] >= 0 {
}
result = append(result, slice)
})
- if len(result) == 0 {
- return nil
- }
return result
}
if n < 0 {
n = len(b) + 1
}
- result := make([][]int, 0, startSize)
+ var result [][]int
re.allMatches("", b, n, func(match []int) {
+ if result == nil {
+ result = make([][]int, 0, startSize)
+ }
result = append(result, match)
})
- if len(result) == 0 {
- return nil
- }
return result
}
if n < 0 {
n = len(s) + 1
}
- result := make([][]string, 0, startSize)
+ var result [][]string
re.allMatches(s, nil, n, func(match []int) {
+ if result == nil {
+ result = make([][]string, 0, startSize)
+ }
slice := make([]string, len(match)/2)
for j := range slice {
if match[2*j] >= 0 {
}
result = append(result, slice)
})
- if len(result) == 0 {
- return nil
- }
return result
}
if n < 0 {
n = len(s) + 1
}
- result := make([][]int, 0, startSize)
+ var result [][]int
re.allMatches(s, nil, n, func(match []int) {
+ if result == nil {
+ result = make([][]int, 0, startSize)
+ }
result = append(result, match)
})
- if len(result) == 0 {
- return nil
- }
return result
}