[Solved] Split a string via double occurances and single occurances of the number 1


Came up with this.

(?:1(?=(?:11)*(?!1))|11|2)

It basically just gets the first odd 1, then gets evens.

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

Explained

 (?:
      1                   # First, try 1
      (?=                 # Must be followed by even amount of 1's
           (?: 11 )*
           (?! 1 )
      )
   |  11                  # Or, only even's left, just get 11
   |  2                   # Or, How about a  2 ?
 )

3

solved Split a string via double occurances and single occurances of the number 1