How to use regex to extract nested patterns

Posted by Rob Romanek on Stack Overflow See other posts from Stack Overflow or by Rob Romanek
Published on 2010-03-17T18:27:19Z Indexed on 2010/03/17 18:31 UTC
Read the original article Hit count: 549

Filed under:
|

Hi I'm struggling with some regex

I've got a string like this:

a:b||c:{d:e||f:g}||h:i

basically name value pairings. I want to be able to parse out the pairings so I get:

a:b
c:{d:e||f:g}
h:i

then I can further parse the pairings contained in { } if required It is the nesting that is making me scratch my head. Any regex experts out there that can give me a hand?

thanks,

Rob

© Stack Overflow or respective owner

Related posts about regex

Related posts about nested