import "regexp"
func pathExtractor(input string) [][][]byte {
- surroundRegex := "[^][ \\t:'\"]"
- r := regexp.MustCompile("(" + surroundRegex + "*[\\./]" + surroundRegex + "*)")
+ surroundRegex := "[^][ \\t:'\"]*"
+ r := regexp.MustCompile("(" + surroundRegex + "[\\./]" + surroundRegex + ")")
temp := [][][]byte{}
temp = r.FindAllSubmatch([]byte(input), -1)
return temp
t.Errorf("Doesnt match multi", output)
}
+ output = GetAllMatches("user.test.js")
+ if len(output) != 1 {
+ t.Errorf("Doesnt match multiple extensions", output)
+ }
+
+ output = GetAllMatches("(user.js)")
+ if len(output) != 1 {
+ t.Errorf("Doesnt match surrounded by parens", output)
+ }
+
output = GetAllMatches("var/")
if len(output) != 1 {
t.Errorf("Doesnt match dir", output)
}
func containsInvalidString(input string) bool {
- invalidStrings := []string{"(", ")", "and/or", "origin/", "{", "}", "<", ">", "$", "*", "this."}
+ invalidStrings := []string{"()", "and/or", "origin/", "{", "}", "<", ">", "$", "*", "this."}
for _, s := range invalidStrings {
if strings.Contains(input, s) {
return true