Hi
Assuming you want the period or parenthesis character to be the same on each end of the match, the following code works:
use warnings; use strict; use feature 'say'; while (<DATA>) { chomp; if (/1([)|\.])(.*)(2\1)/) { say $2; } else { say "BAD LINE:", $_; } } __DATA__ 1) some text 2) 1. some text 2. 1) some text 2. 1. 2.10.10.20 some text 2. 1) 2.10.10.20 2)
In reply to Re: regular expression for getting text between 1. and 2.
by Loops
in thread regular expression for getting text between 1. and 2.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |