in reply to new to perl : how to match ?
The the problem is elsewhere in your code and/or logic. See the snippet below:
use strict; use warnings; my( @strings ) = ( 'data to gbsdff03dfif7 is', 'data to HR620-Asdf2', 'data to HP650dfgd-Af452 is' ); foreach my $line ( @strings ) { print "Matched $line.\n" if $line =~ /to (.*?) is/i; }
And the output is:
Matched data to gbsdff03dfif7 is. Matched data to HP650dfgd-Af452 is.
As you see, your regexp (which I cut and pasted along with your data) matches the first line and the third, not the middle line.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: new to perl : how to match ?
by Sun (Initiate) on Oct 28, 2005 at 06:40 UTC | |
by davido (Cardinal) on Oct 28, 2005 at 06:49 UTC | |
by Sun (Initiate) on Oct 28, 2005 at 08:21 UTC | |
by McDarren (Abbot) on Oct 28, 2005 at 08:53 UTC | |
by Sun (Initiate) on Oct 28, 2005 at 09:24 UTC | |
|