Enable RE modifiers for complex expressions in PostMaster filters

I added a few lines to MatchDBSource.pm in order to allow using more complex regular expressions by adding RE modifiers (imxs). I patched 2.1.3 but current CVS sources differ only slightly. With this patch the filter expression is checked for having slash delimiters (/) and maybe modifiers at the end. If delimiters are in place the default modifier is replaced. A few examples. "asd" = looks for the given string; just like before "/asd/" = looks for the given string, omitting the i-modifier, thus enabling case sensitiveness "/^start of body.*end of body$/ims" = some multi line matching Hope this is useful for someone, comments are welcome. ############################################################################## 67c67,79 < if ($Param{GetParam}->{$_} && $Param{GetParam}->{$_} =~ /$Match{$_}/i) { ---
my $pattern = $Match{$_}; my $modifier = 'i'; if ($pattern =~ /^\/(.*)\/([imsx]*)$/) { $pattern = $1; $modifier = $2; } if ($Param{GetParam}->{$_} && $Param{GetParam}->{$_} =~ /(?$modifier)$pattern/) {
############################################################################## Regards Manfred Dohmen _______________________________________________________________ SMS schreiben mit WEB.DE FreeMail - einfach, schnell und kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
participants (1)
-
Manfred Dohmen