regex to be more restrictive and consistent
This commit is contained in:
@@ -22,8 +22,7 @@ var (
|
|||||||
// \p{Mn}\p{Mc} - combining marks and spacing combining marks
|
// \p{Mn}\p{Mc} - combining marks and spacing combining marks
|
||||||
// \p{Nd} - decimal numbers
|
// \p{Nd} - decimal numbers
|
||||||
// \p{Pc} - connector punctuation (like underscore)
|
// \p{Pc} - connector punctuation (like underscore)
|
||||||
// \p{Sm}\p{So} - math symbols and other symbols
|
fieldRegex = regexp.MustCompile(`^\.[a-zA-Z_\p{L}][a-zA-Z$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}-]*?$`)
|
||||||
fieldRegex = regexp.MustCompile(`^\.[a-zA-Z_\p{L}][a-zA-Z$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\p{Sm}\p{So}-]*?$`)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Parse(str string) (Selector, error) {
|
func Parse(str string) (Selector, error) {
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ func TestParse(t *testing.T) {
|
|||||||
".mixed_kebab-case",
|
".mixed_kebab-case",
|
||||||
".with$dollar",
|
".with$dollar",
|
||||||
".MIXED_Case_123",
|
".MIXED_Case_123",
|
||||||
".unicode⌘",
|
".unicodeø",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, field := range validFields {
|
for _, field := range validFields {
|
||||||
|
|||||||
Reference in New Issue
Block a user