signed-commit remote shell (see also https://github.com/dyne/scorsh)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
scorsh/sandpit/test_regexp.go

26 lines
325 B

package main
import(
"regexp"
"log"
)
func main (){
pattern := ".*"
str := "my_string"
matched, err := regexp.MatchString(pattern, str)
if err != nil {
log.Fatal("Error matching string: ", err)
}
if matched {
log.Printf("Yes! '%s' matched '%s'\n", str, pattern)
} else {
log.Printf("Bad luck!\n")
}
}