Find regex
regex-names.mime
var b = buffer("main.go");
while(b.find(regex("\n[a-z]+ [a-z]+\\(")) >= 0) {
b.backward();
b.set_mark();
b.rfind(" ");
b.forward();
print(b.copy());
}
main.go
If there is a file “main.go” in the same directory with the below contents,
package main
import "fmt"
func main() {
fmt.Print(hello(), world())
}
func world() string {
return "world!"
}
func hello() string {
return "Hello "
}
Then running the above mime script with:
mime regex-names.mime
would print this output
main
world
hello