I made a program for validate the names of the users but regexp will give me the compile time panic error why it so happen and how to resolve it below is the program I'm using :-
package main
import (
"fmt"
"regexp"
)
func main() {
var arr [5]string
arr[0] = "O’max"
arr[1] = "O’sdf"
arr[2] = "dsf’max"
arr[3] = "dsfrewwerx"
arr[4] = "ewrwerwerwerwr’max"
var validName = regexp.MustCompile("^[a-zA-ZÀ-ž\x7f-\xff\u00c0-\u017e0-9-_&$.,'`()!/ ]*$")
for i := 0; i < len(arr); i++ {
if !validName.MatchString(arr[i]) {
fmt.Println(arr[i])
}
}
}
Error
panic: regexp: Compile("^[a-zA-ZÀ-ž\u007f-\xffÀ-ž0-9-&$.,'
()!/ ]*$"): error parsing regexp: invalid UTF-8:
�À-ž0-9-&$.,'()!/ ]*$
Any body tell me How i will make a regrex for the validating the names of the users below is the playground link