Page 1 of 1

Bad regexes in the new css.syx

Posted: 02 Aug 2022 20:00
by pjj
According to W3C,
In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit.
https://www.w3.org/TR/CSS2/syndata.html
Regex in the newest (posted in the forums) css.syx doesn't observe this (all IDs above the empty line should be yellow, while none of the IDs below it should be yellow):
old-syx.css.png
old-syx.css.png (3.47 KiB) Viewed 1040 times
I have prepared better one (not perfect, but covers most of the basic cases):
new-syx.png
new-syx.png (2.82 KiB) Viewed 1040 times
It goes like this:

Code: Select all

#-?[a-zA-Z_][a-zA-Z0-9_\-]+
Could you please update css.syx with the new regexes (for #IDs and .classes)? Thank you!