Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
.NET 7.0 (C#)

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

Description

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

  • Must start with a lower case alphabet (a through z)
  • Must have no digits (0 - 9)
  • 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

  • streamIO is valid lower camel case with no digits allowed - Upto 3 upper case letters
  • deviceID is valid lower camel case with no digits allowed - Upto 3 upper case letters
  • serialNo is valid lower camel case with no digits allowed - Upto 3 upper case letters
  • awsVPC is valid lower camel case with no digits allowed - Upto 3 upper case letters
Submitted by anonymous - 2 years ago (Last modified 2 years ago)