Regex Essentials: Validating HTML id Attributes
When we initially started building our test recorder, we needed a way to validate the id attributes being used on the page. We would sometimes capture an id attribute in a recording, only to find that it failed when we used it in a test, because it didn’t meet specification. For instance, sometimes websites would use an id with a number in front, like this: That is technically invalid, at least in the HTML4 specification.