Re: [SCM] Debian package checker branch, master, updated. 2.2.12-15-g67f5991
Hi,
Russ Allbery wrote:
> --- a/lib/Spelling.pm
> +++ b/lib/Spelling.pm
> @@ -575,9 +575,10 @@ sub spelling_check {
> return unless $text;
>
> $text = lc $text;
> - $text =~ s/[.,;:?!()[\]]//g;
> + $text =~ s/[()[\]]//g;
>
> for my $word (split(/\s+/, $text)) {
> + $word =~ s/[.,;:?!]+$//;
May I suggest moving that regex out of the for loop? it is faster to apply a
regex to a large string once than applying it to lots of small strings.
The following regex should do it:
$text =~ s/(?:[()[\]]|[.,;:?!]+(?=\s))//g;
Cheers,
--
Raphael Geissert - Debian Maintainer
www.debian.org - get.debian.net
Reply to: