I am trying to validate IDs for HTML 5, jQuery, and CSS
For HTML 5, it's pretty easy: basically just \S+
. Yes, you do need one character, but in practice this is never an issue for me.
The problem is with jQuery. I need to weed out at least the apostrophe (') and quote (") characters, plus parenthesis '(' and ')'. When I try to use a jQuery selector like: #he(llo) it throws an Exception.
Right now I am validating my ids negatively in two steps. First, check for matches with '\s', then with the specific characters mentioned above.
I am just wondering if it is possible to do this in 1 regex - especially like "check for \S, plus..." ex. [\S\'\"\(\)]