camelCase regex pattern

Copy and test a JavaScript regex for camelCase identifiers, with examples, limitations, and a one-click link to the regex tester.

camelCase regex pattern

Validate whole value

Use anchors to check whether the complete value matches.

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

Flags: -

Search in text

Find matching fragments inside a larger block of text.

Regex: \b[a-z]+(?:[A-Z][a-z0-9]*)+\b

Flags: g

Examples that match

  • camelCase
  • userId2

Examples that do not match

  • CamelCase
  • snake_case

Limitations

This practical pattern focuses on typical camelCase names and does not try to cover every acronym-heavy naming style.