1

I have following question need reg expert help. I have a string "11122233344456", I need put same digits into a string. For above example, it shall be "111","222","333","444","5","6".

Another example: "223334456111", it shall be "22","333","44","5","6","111".

Would some regex expert help me to find the solution?

user84592
  • 4,750
  • 11
  • 55
  • 91

1 Answers1

2

You can use this regex:

((\d)\2*)

And grab captured group #1

RegEx Demo

Community
  • 1
  • 1
anubhava
  • 761,203
  • 64
  • 569
  • 643