http://www.perlmonks.org?node_id=1028382


in reply to regular expression for getting text between 1. and 2.

Just leave the ? out.

1[)|.](.*)2[)|.]

Replies are listed 'Best First'.
Re^2: regular expression for getting text between 1. and 2.
by CountOrlok (Friar) on Apr 12, 2013 at 21:04 UTC
    Funny. The user asked the same question on SO and I replied with this same answer but he then came up with more input strings that complicate the regex.

      This is a problem with many regex questions here and elsewhere. Just a handful of examples usually do not really explain what the pattern is. Sometimes I find it challenging to "guess" what the real question is (sometimes this is impossible) and sometimes I just answer what was asked for. The hope is that the OP learns something from either answer. At least I often do...