Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Fix comment errors and $replace_string error in Regex.pm, noticed by …
Browse files Browse the repository at this point in the history
…cotto++ .
  • Loading branch information
pmichaud committed May 14, 2010
1 parent 8bc24ed commit 8e3df2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/setting/Regex.pm
Expand Up @@ -9,7 +9,7 @@ Regex methods and functions
=begin item match
Match C<$text> against C<$regex>. If the C<$global> flag is
given, then return an array of all non-overlapping matches.
=end
=end item

sub match ($text, $regex, :$global?) {
my $match := $text ~~ regex;
Expand All @@ -31,7 +31,7 @@ sub match ($text, $regex, :$global?) {
Substitute an match of C<$regex> in C<$text> with C<$replacement>,
returning the substituted string. If C<$global> is given, then
perform the replacement on all matches of C<$text>.
=end
=end item

sub subst ($text, $regex, $repl, :$global?) {
my @matches := $global ?? match($text, $regex, :global)
Expand All @@ -44,7 +44,7 @@ sub subst ($text, $regex, $repl, :$global?) {
my $repl_string := $is_code ?? $repl($match) !! $repl;
@pieces.push( pir::substr($text, $offset, $match.from - $offset))
if $match.from > $offset;
@pieces.push($replace_string);
@pieces.push($repl_string);
$offset := $match.to;
}

Expand Down

0 comments on commit 8e3df2d

Please sign in to comment.