File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ func makeMatcher(tags map[string]interface{}) regexMatcher {
22
22
return regs
23
23
}
24
24
25
+ // FindTagIndex finds an index contained in the regex map and, if found, returns
26
+ // the position of the tag in the string and the tag itself as an interface value
25
27
func (r regexMatcher ) FindTagIndex (str string ) ([]int , interface {}) {
26
28
lower := strings .ToLower (str )
27
29
for reg , tag := range r {
@@ -32,13 +34,16 @@ func (r regexMatcher) FindTagIndex(str string) ([]int, interface{}) {
32
34
return nil , nil
33
35
}
34
36
37
+ // FindTag is a helper function for FindTagIndex which only returns the tag value itself
35
38
func (r regexMatcher ) FindTag (str string ) interface {} {
36
39
if _ , t := r .FindTagIndex (str ); t != nil {
37
40
return t
38
41
}
39
42
return nil
40
43
}
41
44
45
+ // FindAllTagsIndex find all tags in a string and returns two slices, the index positions
46
+ // of the tags and the tag values themselves
42
47
func (r regexMatcher ) FindAllTagsIndex (str string ) ([]int , []interface {}) {
43
48
var tags []interface {}
44
49
var idx []int
You can’t perform that action at this time.
0 commit comments