I have a large word list file with one word per line. I would like to filter out the words with repeating alphabets.
INPUT:
abducts
abe
abeam
abel
abele
OUTPUT:
abducts
abe
abel
I’d like to do this using Regex (grep or perl or python). Is that possible?
It’s much easier to write a regex that matches words that do have repeating letters, and then negate the match:
(This code assumes that
@inputcontains one word per entry.) But this problem isn’t necessarily best solved with a regex.I’ve given the code in Perl, but it could easily be translated into any regex flavor that supports backreferences, including
grep(which also has the-vswitch to negate the match).