-3

For example, I would like to find ty in:

erytypotym5ty    
etytyty    
koetymitywty

or il in:

keililmil    
ilwrilltyil5ile
anubhava
  • 713,503
  • 59
  • 514
  • 593
jikix
  • 39
  • 1
  • 4

1 Answers1

0

^.*(\w{2}).*\1.*\1.*$.

The two letters (also digits and _; you could replace \w with [a-zA-Z], if you don't want them) will be in group 1.

https://regex101.com/r/11Oq70/1

Alexander Mashin
  • 3,624
  • 1
  • 7
  • 14