Regex (JS) - match any combination of 5 characters, but ignore 5-character repeat
I am struggling with regexes and I am trying to create one that can match any combination of 5 characters X
and O
, but ignore it if it repeats X
or O
EXACTLY 5 times.
This is what I came up with:
X{1,4}|O{1,4}
X|O{1,4}
these expressions match (I want it to ignore XXXXX and OOOOO):
I also tried using a non-capturing group, (?:)
but that didn't work too well.
+3
source to share