Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(.)(?!(\1)).+$
/
gm

Description

this regex won't let two characters to be similar. eg. AA, AAA, AAAA this regex matches all string characters including numbers and except line breaks. It prevents input of string similar to the following pattern: 11 222 3333 4444 aa AAA AA BBB CCCC

Submitted by anonymous - 5 years ago