Can you help me to build a regex that matches a valid W3C HTML 4.01 id value?
id
According with W3C specs:
ID and NAME tokens must begin
You can use this regex
^[a-zA-Z][\w:.-]*$
^ depicts the start of string
^
[a-zA-Z] matches an uppercase or lowercase letter
[a-zA-Z]
* matches the preceding character 1 to many times
*
\w is similar to [a-zA-Z\d_]
\w
[a-zA-Z\d_]
$ is the end of string
$