in reply to Re: Generalising string in pattern
in thread Generalising string in pattern

#!/usr/bin/perl

$filepath="D:/fetch/autofetch.log";

my $pattern1 =' Latest 29 Items in Feed & 0 New Fetched items';

sysopen($FILE,$filepath,o_RDWR) or die "could find the file";

while (my $line = <$FILE>) { # print $line if ($line =~m/\b$pattern1/ ); if($line =~m/$pattern/ ) { print $line; }

In the file i am searching for $pattern1.

The file has

Latest 29 Items in Feed & 0 New Fetched items

Latest 28 Items in Feed & 0 New Fetched items

Latest 28 Items in Feed & 0 New Fetched items

Now i want pattern to match all 3..

But now my present pattern matches only first one

Replies are listed 'Best First'.
Re^3: Generalising string in pattern
by Corion (Patriarch) on Nov 13, 2009 at 08:45 UTC

    See perlre about \d, or about the [...] character class notation.

    Also, you might want to use <code>...</code> tags around your code and data so it renders and downloads nicely.