Regular Expressions 101

Community Patterns

Camel Case - digits allowed - Upto 3 upper case letters

0

Regular Expression
.NET 7.0 (C#)

@"
^[a-z][a-z0-9]*(([A-Z]{1,3}[a-z0-9]+)*[A-Z]{0,3}|([a-z0-9]+[A-Z]{1,3})*|[A-Z]{1,3})$
"
gm

Description

Camel Case - digits allowed - Upto 3 upper case letters

To be proper camel case a word with digits allowed and upto 3 upper case letters, a word:

  • MUST start with a lower case alphabet (a through z)
  • MUST have no spaces, punctuation or special characters
  • CAN have at most 3 uppercase alphabets in a row
  • CAN end in an uppercase alphabet

Notable examples

  • camel01CC01 is valid lower camel case, with digits allowed , with upto 3 upper case letters
Submitted by anonymous - 2 years ago