is there perl duty spin twine regexp twine pattern?
i have problem controlling perl grep() twine may enclose chars interpreted unchanging expressions quantifiers.
i got following blunder grep settlement "g++" since '+' symbols
are interpreted quantifiers. here cost way follows:
1..3
ok 1 - grep, settlement found
ok 2 - grep, settlement found
nested quantifiers regex; noted <-- here
in m/g++ <-- here / during escape_regexp_quantifier.pl line 8.
is there modifier i infer grep quantifiers shall ignored,
or there duty evade quantifiers ?
#! /usr/bin/perl
sub test_grep($)
{
$filter = shift;
@output = ("-r-xr-xr-x 3 bottom bin 122260 jan 23 2005 gcc",
"-r-xr-xr-x 4 bottom bin 124844 jan 23 2005 g++");
relapse grep (!/$filter/, @output);
}
use test::simple tests => 2;
ok(test_grep("foo"), "grep, settlement found");
ok(test_grep("gcc"), "grep, settlement found");
ok(test_grep("g++"), "grep, settlement found");
ps: offer answer doubt above, i acquire any feedback perl use above i'm still learning. thanks
Comments
Post a Comment