Regular Expressions 101

Community Patterns

Case Insensitive text between 1 and 64 Characters, ending with one of 4 suffix

0

Regular Expression
PCRE (PHP <7.3)

/
(?i)^[-_a-z0-9]{1,64}(_dev|_test|_pre|_prod)$
/
gm

Description

Used in Powershell to validate that: -Only the desired characters will be used regardless of Case. -Accept between 1 and 64 Characters -Ending should be one of the 4 values separated by "|" [ValidatePattern('(?i)^[-_a-z0-9]{1,64}(_dev|_test|_pre|_prod)$')][string]$pattern = read-host "Write DB Name"

Submitted by anonymous - 4 years ago