Support whitespace and escaped slashes in /regex/
This commit is contained in:
parent
feddb8c788
commit
a9482754eb
1 changed files with 9 additions and 5 deletions
|
@ -6,10 +6,14 @@
|
||||||
sub _read_warnings {
|
sub _read_warnings {
|
||||||
open my $fh, 'revbank.warnings' or die $!;
|
open my $fh, 'revbank.warnings' or die $!;
|
||||||
return map {
|
return map {
|
||||||
my ($matcher, $text) = split " ", $_, 2;
|
my ($regex, $products, $text) = m[^
|
||||||
chomp $text;
|
(?:
|
||||||
|
/((?>[^/\\]++|\\.)*+)/ # /regex with support for \/escaped\/ slashes/
|
||||||
my ($regex) = $matcher =~ m[^/([^/]+)/$];
|
| (\S+) # products IDs, comma separated
|
||||||
|
)
|
||||||
|
\s+
|
||||||
|
(.*)
|
||||||
|
]x;
|
||||||
|
|
||||||
$regex
|
$regex
|
||||||
? sub {
|
? sub {
|
||||||
|
@ -18,7 +22,7 @@ sub _read_warnings {
|
||||||
}
|
}
|
||||||
: sub {
|
: sub {
|
||||||
my ($id, $desc) = @_;
|
my ($id, $desc) = @_;
|
||||||
(grep { $_ eq $id } split /,/, $matcher) ? $text : ();
|
(grep { $_ eq $id } split /,/, $products) ? $text : ();
|
||||||
}
|
}
|
||||||
} grep /\S/, grep !/^\s*#/, readline $fh;
|
} grep /\S/, grep !/^\s*#/, readline $fh;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue