-3

I want to match all these using 1 single regex code. https://regex.alf.nu/4 I wrote this ([a-z]{2})(\w+)?\1 but its not working

  1. anallagmatic
  2. bassarisk
  3. abba
  4. chorioallantois
  5. coccomyces
  6. commotive
  7. engrammatic
  8. glossoscopia
  9. hexacoralla
  10. hippogriffin
  11. inflammableness
  12. otto
  13. overattached
  14. saffarid
  15. sarraceniaceae
  16. scillipicrin
  17. tlapallan
  18. trillion
  19. unclassably
  20. unfitting
  21. unsmelled
  22. warrandice
Rahul Saxena
  • 422
  • 1
  • 9
  • 22

2 Answers2

0

This looks like the opposite of the regex golf question you linked. The shortest answer I can come up with to match all of those words (and none of the other set of words) is:

(.)(.)\2\1
Adam Katz
  • 14,455
  • 5
  • 68
  • 83
0

Try this:

\b\w*(.)(.)\2\1\w*\b

Demo

walid toumi
  • 2,172
  • 1
  • 13
  • 10