0

Consider the following string: EFEIEDKKTIGTELIYLIKKNG. I have written a regular expression to match the portion between Ks (KKTIGTELIYLIKK) and assign it to different capture groups. My regex is (?=(K+[^K]+K+)) and yields two substrings, KTIGTELIYLIKK and KKTIGTELIYLIKK.

Now, how can I improve it to detect multiple Ks at the end as well? What I would like to detect is KTIGTELIYLIKK, KTIGTELIYLIK, KKTIGTELIYLIK and KKTIGTELIYLIKK. Is it even possible?

https://regex101.com/r/S0b6vb/1

ftabaro
  • 136
  • 11

0 Answers0