package main
import (
"fmt"
"regexp"
)
func main() {
// Declare the regex pattern
pattern := regexp.MustCompile(`^htt+p$`)
// Test strings
testStrings := []string{"http", "htttp", "httttp", "httpp", "htp"}
// Check matches
for _, test := range testStrings {
match := pattern.MatchString(test)
fmt.Printf("Matches \"%s\": %t\n", test, match)
}
}
// Matches "httpp": True or false, depending on how matches() method works
/*
run:
Matches "http": true
Matches "htttp": true
Matches "httttp": true
Matches "httpp": false
Matches "htp": false
*/