We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
func reg() { // 判断汉字字母数字 s := "nihao你好243" // str := `^[\u4e00-\u9fa5]+$` // d:\mygo\src\ch\t>go test -v -run TestReg // === RUN TestReg // --- FAIL: TestReg (0.00s) // panic: regexp: Compile(`^[\u4e00-\u9fa5]+$`): error parsing regexp: invalid escape sequence: `\u` [recovered] // panic: regexp: Compile(`^[\u4e00-\u9fa5]+$`): error parsing regexp: invalid escape sequence: `\u` // str := "^[a-zA-Z0-9\u4e00-\u9fa5]+$" // ok // str := `^[a-z0-9A-Z\p{Han}]+(_[a-z0-9A-Z\p{Han}]+)*?$` str := `^[a-z0-9A-Z\p{Han}]+$` // ok r := regexp.MustCompile(str) b := r.MatchString(s) fmt.Println(b) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: