In my program , i want to validate id of html tags.. To my functions id is passed as a string preceeding with #.. I found that ,rules for naming and id in HTML are,
- Must begin with a letter A-Z or a-z
Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"), and underscores ("_") So i written the following regular expression.
/(^|\s)(#{1})([a-zA-Z])([^a-zA-Z0-9]{0})/g;
But it is giving me wrong results.What's wrong with my regular expression?