Regex that matches Camel and Pascal Case

camelCase:

^[a-z]+(?:[A-Z][a-z]+)*$

PascalCase:

^[A-Z][a-z]+(?:[A-Z][a-z]+)*$

/([A-Z][a-z]+)*[A-Z][a-z]*/

But I have to say your naming choice stinks, HTMLParser should be allowed and preferred.


I don't believe the items listed can start with numbers (thought I read it somewhere so take it with a grain of salt) so the best case would be something like Roger Pate's with a few minor modifications (in my opinion)

/([A-Z][a-z0-9]+)*[A-Z][a-z0-9]*/

Should be something like, Look for a Capital Letter, then at least one small case or number, or more, as well as it looks like it handles just a capital letter as that seems to be required, but the additional letters are optional.

Good luck