What are the (full) valid / allowed charset characters for CSS identifiers id and class?
Is there a regular expression that I can use to validate against? Is it browser agnostic?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The charset doesn’t matter. The allowed characters matters more. Check the CSS specification. Here’s a cite of relevance:
Update: As to the regex question, you can find the grammar here:
Which contains of the parts:
This can be translated to a Java regex as follows (I only added parentheses to parts containing the OR and escaped the backslashes):
Update 2: oh, you’re more a PHP’er, well I think you can figure how/where to do
str_replace?