RegEx to extract all data between two patterns

Hi,
I am looking for regular expression that will extract all data between two patterns. Pattern looks like this :\d\d: I come up with expression “(:\d\d:)([^:])” that outputs two groups. But in some rare cases it doesn’t work because there could be a colon in extracted text. Do you have any ideas how to solve this problem?

I have a document that looks like this:
"
:20:1:23
:21:abc:123
:20:bla bla bla
<123
<456
:21:bla bla
bla
:26: bla : bla bla
<123
"

and I would like output to be like this:
"
match 1
group1 [:20:] group2 [1:23]

match 2
group1 [:21:] group2 [abc:123]

match 3
group1 [:20:] group2 [bla bla bla
<123
<456]

match 4
group1 [:21:] group2 [bla bla
bla]

match 5
group1 [:26:] group2 [bla : bla bla
<123]
"

Hi @piomio

Can you provide the Expected output for the same so that it will be easy for us to give you perfect regex

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Each match should have 2 groups:
1 group should be code with this pattern :\d\d:
and 2 group should be everything (text, digits, white-space, line breaks, colon ect.)until next code with pattern :\d\d:

match 1
group1 [:20:]
group2 [1:23]

match 2
group1 [:21:]
group2 [abc:123]

match 3
group1 [:20:]
group2 [bla bla bla
<123
<456]

match 4
group1 [:21:]
group2 [bla bla
bla]

match 5
group1 [:26:]
group2 [bla : bla bla
<123]

Hello

Check out my post if you want to improve your Regex skills and solve your problem at the same time…