Created
April 16, 2018 10:57
-
-
Save hyuki/b98fe9f69c2cb403cebcb992d2ae0c9e to your computer and use it in GitHub Desktop.
簡単なテキストチェッカ(実験中。とりあえず「をを」だけを見つける)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//usr/bin/env go run $0 $@ ; exit | |
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"regexp" | |
) | |
func match(re string, line string) []string { | |
return regexp.MustCompile(re).FindStringSubmatch(line) | |
} | |
func main() { | |
stdin := bufio.NewScanner(os.Stdin) | |
for linenumber := 1; stdin.Scan(); linenumber++ { | |
line := stdin.Text() | |
if m := match(`^(.*?)(をを)(.*?)$`, line); m != nil { | |
fmt.Printf("%d: %s【%s】%s\n", linenumber, m[1], m[2], m[3]) | |
} | |
} | |
} |
Author
hyuki
commented
Apr 16, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment