Regex for capturing numbered text list
        Posted  
        
            by crunchyt
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by crunchyt
        
        
        
        Published on 2010-03-21T13:41:20Z
        Indexed on 
            2010/03/21
            13:51 UTC
        
        
        Read the original article
        Hit count: 589
        
I have a test list that I am trying to capture data from using a regex.
Here is a sample of the text format:
(1) this is a sample string /(2) something strange /(3) another bit of text /(4) the last one/ something!/
I have a Regex that currently captures this correctly, but I am having some difficulty with making it work under outlier conditions.
Here is my regex
/\(?\d\d?\)([^\)]+)(\/|\z)/
Unfortunately some of the data contains parentheses like this:
(1) this is a sample string (1998-1999) /(2) something strange (blah) /(3) another bit of text /(4) the last one/ something!/
The substrings '(1998-1999)' and '(blah)' make it fail!
Anyone care to have a crack at this one? Thank you :D
© Stack Overflow or respective owner