How can I use the or
operator while not allowing repetition? In other words the regex:
(word1|word2|word3)+
will match wo
Byers' solution is too hard coded and gets quite cumbersome after the letters increases.. Why not simply have the regex look for duplicate match?
([^\d]+\d)+(?=.*\1)
If that matches, that match signifies that a repetition has been found in the pattern. If the match doesn't work you have a valid set of data.