You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"fmt"
"regexp"
)
const (
DomainRegexText = `^[\p{L}\p{N}\-]{1,63}$`
)
func main() {
domainRegex := regexp.MustCompile(DomainRegexText)
domains := []string{"", "a", "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz-0123456789", "abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-0123456789", "कारबीमा"}
for _, domain := range domains {
fmt.Printf("'%s' with len := %d\n", domain, len(domain))
if domainRegex.MatchString(domain) {
fmt.Println("REGEX matched!")
} else {
fmt.Println("REGEX did NOT match!!")
}
}
}
'' with len := 0
REGEX did NOT match!!
'a' with len := 1
REGEX matched!
'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz-0123456789' with len := 63
REGEX matched!
'abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-0123456789' with len := 64
REGEX did NOT match!!
'कारबीमा' with len := 21
REGEX did NOT match!!
What did you expect to see?
I'm not a Hindi language expert, but it seems that 'कारबीमा' should match the RegEx
What did you see instead?
'कारबीमा' failed match
Dropping the $ from the compiled RegEx allows it to match, but then the size check fails over 63 characters (as it should).
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Behavior present on latest macOS and in Go Playground https://play.golang.com/p/x6q9rbx33ag
What did you expect to see?
I'm not a Hindi language expert, but it seems that 'कारबीमा' should match the RegEx
What did you see instead?
'कारबीमा' failed match
Dropping the $ from the compiled RegEx allows it to match, but then the size check fails over 63 characters (as it should).
The text was updated successfully, but these errors were encountered: