Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

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

Description

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

  • MUST start with an upper 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

  • IOStream is valid pascal case with no digits allowed and with upto 3 upper case letters
  • StreamIO is valid pascal case with no digits allowed and with upto 3 upper case letters
  • IOStream is valid pascal case with no digits allowed and with upto 3 upper case letters
  • DeviceID is valid pascal case with no digits allowed and with upto 3 upper case letters
  • AwsVPC is valid pascal case with no digits allowed and with upto 3 upper case letters
  • DeviceSNS is valid pascal case with no digits allowed and with upto 3 upper case letters
  • CreateAMode is valid pascal case with no digits allowed and with upto 3 upper case letters
  • CreateBMode is valid pascal case with no digits allowed and with upto 3 upper case letters
  • ABCabcABCabc is valid pascal case with no digits allowed and with upto 3 upper case letters
  • ABCabcABCabcA is valid pascal case with no digits allowed and with upto 3 upper case letters
Submitted by anonymous - 2 years ago (Last modified 2 years ago)