jeudi 23 avril 2020

Regex pattern question - 'letter-number' sequence patterns [duplicate]

I have sequence:

r2r16r1r1r1r1r16r1r1

I want to find all sequences of 'r1', and minimum sequence length = 3, which is 'r1r1r1' (and max is 5000)

What I want to get: r2r16r1r1r1r1r16r1r1 (bold is result)

The best pattern I can find is:

(r1){3,5000}

Result: r2r16r1r1r1r1r16r1r1

But this gives me extra 'r1', which is a part of 'r16', but I need only 'r1'

Question: what pattern should i use? How to modify my pattern to get the correct result?

Aucun commentaire:

Enregistrer un commentaire