applets/(c99,c11)std: better handling of capture groups within -text option

This commit is contained in:
Pragmatic Software 2022-07-04 09:52:50 -07:00
parent 0cf80092a7
commit 0023790fec
3 changed files with 14 additions and 6 deletions

8
applets/c11std.pl vendored
View File

@ -239,8 +239,12 @@ if (length $match_text) {
$match_result =~ s/\s+/ /g;
my $match = eval {
$match_result =~ m/(.*)($match_text)(.*)/msi;
return [$1, $2, $3];
my @matches = ($match_result =~ m/($match_text)/msp);
if (@matches > 1) {
shift @matches;
@matches = grep { length $_ } @matches;
}
return [${^PREMATCH}, join (' ... ', @matches), ${^POSTMATCH}];
};
if ($@) {

8
applets/c99std.pl vendored
View File

@ -239,8 +239,12 @@ if (length $match_text) {
$match_result =~ s/\s+/ /g;
my $match = eval {
$match_result =~ m/(.*)($match_text)(.*)/msi;
return [$1, $2, $3];
my @matches = ($match_result =~ m/($match_text)/msp);
if (@matches > 1) {
shift @matches;
@matches = grep { length $_ } @matches;
}
return [${^PREMATCH}, join (' ... ', @matches), ${^POSTMATCH}];
};
if ($@) {

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4549,
BUILD_DATE => "2022-07-03",
BUILD_REVISION => 4550,
BUILD_DATE => "2022-07-04",
};
sub initialize {}