Skip to content

Commit 71260a8

Browse files
author
Minori Tokuda
committed
fix matcher
1 parent 9708a1c commit 71260a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ func run() error {
3939
return nil
4040
}
4141

42-
var matcher = regexp.MustCompile(`^(FROM|from) \w+ (AS|as) (\w+)$`)
42+
var matcher = regexp.MustCompile(`^(FROM|from) ([\w:.-]+) (AS|as) (\w+)$`)
4343

4444
func parse(r io.Reader) ([]string, error) {
4545
scanner := bufio.NewScanner(r)
4646
var result []string
4747
for scanner.Scan() {
4848
line := scanner.Bytes()
4949
m := matcher.FindAllSubmatch(line, -1)
50-
if len(m) > 0 && len(m[0]) > 3 {
51-
result = append(result, string(m[0][3]))
50+
if len(m) > 0 && len(m[0]) > 4 {
51+
result = append(result, string(m[0][4]))
5252
}
5353
}
5454
return result, scanner.Err()

0 commit comments

Comments
 (0)