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


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

check this
while(<DATA>) { chomp; if (/^1[.)](.*?)2[.)]$/) { print"matched $1\n"; } else{ print "not matched \n"; } } __DATA__ 1. 2.10.10.20 some text 2. 1) 2.10.10.20 2)