-1

I have the following regex expression:

[0-7]{2}

For the following string 234212, I get three matches:

23   
42
12

I don't understand why I don't get also 34, 12?

anubhava
  • 761,203
  • 64
  • 569
  • 643
Code Pope
  • 5,075
  • 8
  • 26
  • 68

1 Answers1

0

You can try this:

(?=([0-7]{2}))

The above regex captures every valid pair in group 1 , I have used the positive look-ahead to achieve this as this helps to match without moving the cursor forward.

Demo

Mustofa Rizwan
  • 10,215
  • 2
  • 28
  • 43