From: Mark Wooding Date: Sun, 11 Jun 2023 15:35:10 +0000 (+0100) Subject: mason/.perl-lib/TrivGal.pm: Expand a couple of compicated regices. X-Git-Url: https://git.distorted.org.uk/~mdw/tgal/commitdiff_plain/9fc5e8c1660ca79782e0ed03361baff3eb120044 mason/.perl-lib/TrivGal.pm: Expand a couple of compicated regices. Yes, that is the correct plural. Fight me. --- diff --git a/mason/.perl-lib/TrivGal.pm b/mason/.perl-lib/TrivGal.pm index 85bf0cc..193f122 100644 --- a/mason/.perl-lib/TrivGal.pm +++ b/mason/.perl-lib/TrivGal.pm @@ -69,7 +69,10 @@ export qw{split_path}; sub split_path ($) { my ($path) = @_; - my ($dir, $base, $ext) = $path =~ m#^(?:(.*)/)?(?:([^/]*)\.)?([^./]*)$#; + my ($dir, $base, $ext) = + $path =~ m#^ (?: (.*) /)? + (?: ([^/]*) \.)? + ([^./]*) $#x; if (defined $base) { $ext = ".$ext"; } else { $base = $ext; $ext = ""; } return ($dir, $base, $ext); @@ -294,7 +297,12 @@ sub listdir ($) { $comment = defined $comment ? $comment . "\n" . $_ : $_; } else { if ($item && $comment) { $item->comment($comment); } - my ($indexp, $name, $c) = /^(!\s+)?(\S+)\s*(\S|\S.*\S)?\s*$/; + my ($indexp, $name, $c) = + /^ (! \s+)? # index flag + (\S+) \s* # filename + (\S | \S.*\S )? # start of the comment + \s* + $/x; $name = urldecode $name; my $list; if ($name =~ m#/$#) {