Bad regexes in the new css.syx

Report issues, odd behaviors or submit a detailed bug report.
Post Reply
User avatar
pjj
Posts: 2108
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Bad regexes in the new css.syx

Post 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 882 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 882 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!
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Post Reply