GO emoji 正则表达式

Dec 12, 2019
// emoji regexp
// \{1F300}-\x{1F64F}\x{1F680}-\x{1F6FF}\x{2600}-\x{2B55}
emoji := `😂`
if matched := regexp.
	MustCompile(`^[a-zA-Z0-9_\p{Han}\{1F300}-\x{1F64F}\x{1F680}-\x{1F6FF}\x{2600}-\x{2B55}]{1,20}$`).
	Match([]byte(emoji)); true {
	log.Println(matched)
}