Fix replacements (again). Add tests to test words and sequences with punctuation. Fixes bug #12208.
This commit is contained in:
parent
1cc7ac2578
commit
a3ff0fb7a5
3 changed files with 35 additions and 5 deletions
|
|
@ -397,7 +397,11 @@ sub processReplacements {
|
|||
}
|
||||
foreach my $searchFor (keys %{$replacements}) {
|
||||
my $replaceWith = $replacements->{$searchFor};
|
||||
$content =~ s/\b\Q$searchFor\E\b/$replaceWith/gs;
|
||||
my $pattern = qr/\Q$searchFor\E/;
|
||||
if ($searchFor =~ /^\w+/) {
|
||||
$pattern = qr/\b$pattern\b/;
|
||||
}
|
||||
$content =~ s/$pattern/$replaceWith/gs;
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue