For example, I would like to find ty
in:
erytypotym5ty
etytyty
koetymitywty
or il
in:
keililmil
ilwrilltyil5ile
^.*(\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.