Regex replace using a repetitive capture
- by Zac
I have a table like:
A | 1
A | 2
B | 1
B | 2
B | 3
I'm trying to transform it to look like this:
A { 1 | 2 }
B { 1 | 2 | 3 }
I've come up with this which will match correctly I just can't figure out how to get the repeated capture out.
(A|B)|(\d)(\r\n\1|(\d))*