Regular Expressions 101

Community Patterns

Pascal Case - digits allowed - Upto 3 upper case letters

0

Regular Expression
ECMAScript (JavaScript)

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

Description

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

  • MUST start with an upper 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 pascal case with digits allowed and with upto 3 upper case letters
Submitted by anonymous - 2 years ago