-3

For example, I would like to find ty in:

erytypotym5ty    
etytyty    
koetymitywty

or il in:

keililmil    
ilwrilltyil5ile
anubhava
  • 664,788
  • 59
  • 469
  • 547
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,126
  • 1
  • 6
  • 13