Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2016-04-09 05:12
Flavor·Python

r"
((((?<!a)a)|((?<!b)b)|((?<!c)c))((((?<!a)a)|((?<!b)b)|((?<!c)c))(((?<!a)a)|((?<!b)b)|((?<!c)c)))*)?
"
Open regex in editor

Description

Recognizes strings containing {a,b,c} an odd number of times that do not repeat the same letter twice in a row. Also recognizes null string.

Submitted by anonymous