Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?=.*[A-Z])(?=.*[0-9])(?!.\n)(?!.*\s)(?=.*[!$#+@%&]).{8,}
/

Description

(?=.[A-Z]) # must contain 1 uppercase letter (?=.[0-9]) # must contain 1 digit (?!.\n) # must not contain a newline character (?!.\s) # must not contain any whitespace characters (?=.[!$#+@%&]) # nust contain one of these symbols .{8,} # match anything with previous conditions at least 8 characters long

Submitted by anonymous - 9 years ago