This question about Using an extension: Answered
SUBST removes anything after match
SUBST macro rewrites string based on regexp matches. However it does not append text after last match
Example:
%SUBST{text="1 2 3 5 4 6 7" pattern="(5) (4)" format="$2 $1"}%
Result: 1 2 3 4 5
Is this expected behaviour? How can I change text in the middle of the string without loosing the end?
Try this patch against
FilterPlugin:
--- lib/Foswiki/Plugins/FilterPlugin/Core.pm (revision 4704)
+++ lib/Foswiki/Plugins/FilterPlugin/Core.pm (working copy)
@@ -167,7 +167,7 @@
} elsif ($theMode == 1) {
# substitution mode
$result = '';
- while($text =~ /(.*?)$thePattern/gs) {
+ while($text =~ /(.*?)$thePattern/gcs) {
my $prefix = $1;
my $arg1 = $2;
my $arg2 = $3;
@@ -210,6 +210,9 @@
$hits--;
last if $theLimit > 0 && $hits <= 0;
}
+ if ($text =~ /\G(.*)$/) {
+ $result .= $1;
+ }
--
MichaelDaum - 25 Aug 2009
thanks. now it works ok.
--
AndrejStefanko - 26 Aug 2009