[rt-users] patch for CanonicalizeEmailAddress
Stephen Quinney
stephen at jadevine.org.uk
Tue May 17 04:07:33 EDT 2005
On Mon, May 16, 2005 at 01:15:48PM -0400, Phil Lawrence wrote:
> Hi,
>
> As of 3.4.2, canonicalizing fails when the Replace string uses backrefs:
>
> RT_SiteConfig.pm snippet
> ------------------------
> # our users like to just CC usernames instead of
> # typing out the whole username at mycompany.com
> #
> # e.g. 'username' --> 'username at mycompany.com'
> Set($CanonicalizeEmailAddressMatch , '^([\w\-\+]+)$');
> Set($CanonicalizeEmailAddressReplace , '\1\@mycompany\.com');
Back references are used in the "match" side of a s/// regexp not the
"replace" side, in that case you should use $1, $2, etc..
If I run a script such as:
#!/usr/bin/perl
use strict;
use warnings;
my $foo = "username";
$foo =~ s/^([\w\-\+]+)$/\1\@mycompany\.com/;
print $foo . "\n"'
I get the output:
username at mycompany.com
but I also get a warning:
\1 better written as $1 at -e line 1.
I hope that helps,
Stephen
More information about the rt-users
mailing list