- or download this
while ( <DATA> ) {
if ( /^(\d+\/123 11.*?)(?= a )(?:.*?zyx(.*))?/ ) {
...
15/456 11-abc 456 a 1/2 zyx this is it
16/123 11-abc 456 a 1/2 zyx this is the last 3
17/123 11-abc 456 a 1/2 xyz this is the last 3
- or download this
C:\>perl -MYAPE::Regex::Explain -e "print YAPE::Regex::Explain->new('^
+(\d+\/123 11.*?)(?= a )(?:.*?zyx(.*))?')->explain"
The regular expression:
...
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
- or download this
while ( <DATA> ) {
if ( /^(\d+\/123 11.*?) a / ) { #first matched
...
}
}