fork download
  1. package main
  2.  
  3. import (
  4. "regexp"
  5. "fmt"
  6. )
  7.  
  8. func main() {
  9. //var re = regexp.MustCompile(`^[0-9]{8,12}$`)
  10. //var str = `12345678901`
  11. re := regexp.MustCompile(`^[0-9]{8,12}$`)
  12. fmt.Println(re.Match([]byte(`12345678901`)))
  13. fmt.Println(re.Match([]byte(`something else`)))
  14. fmt.Println(re.Match([]byte(`123456789`)))
  15. }
  16.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
true
false
true