Does the Postmaster Filter in the Admin UI support regex backreferences. I'm thinking specifically of capturing something in the filter and then reusing part of it in the "Set Email Headers" section. Is this possible? If so, how?
Btw, I have no problem using the Postmaster Filter modules; just that keeping the email filtering rules in the Admin UI makes them more visible to less experienced OTRS admins (which is who I will be leaving behind after this contract).
PostMaster Filter RegEx question
Moderator: crythias
PostMaster Filter RegEx question
OTRS 3.2.11 on Centos 6.4 with MySQL 5.0. Agents and internal customers authenticate via Active Directory.
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: PostMaster Filter RegEx question
Items matched within parentheses () will fill [***] in set.
Match: (username)@domain
Set: X-OTRS-CustomerUser [***]
Match: (username)@domain
Set: X-OTRS-CustomerUser [***]
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: PostMaster Filter RegEx question
This is what I thought, based on the example in Core::Postmaster, but for some reason, I can't get it working. What's the significance of three asterisks - should there be more if I'm matching more than one character?crythias wrote:Items matched within parentheses () will fill [***] in set.
Match: (username)@domain
Set: X-OTRS-CustomerUser [***]
I've got
Code: Select all
Match: Subject = ^\[Ticket\#([0-9]+)\]
Set:
X-OTRS-Queue = Legacy Tickets
X-OTRS-TicketKey1 = Legacy Ticket Number
X-OTRS-TicketValue1 = [***]
EDIT: The Perl script that works...
Code: Select all
#!/bin/perl -w
use strict;
my $ticketNum = '[Ticket#201101041023456] Problem with some issue';
if($ticketNum =~ m/^\[Ticket\#([0-9]+)\]/) {
print "The ticket number is $1.\n";
}
OTRS 3.2.11 on Centos 6.4 with MySQL 5.0. Agents and internal customers authenticate via Active Directory.
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: PostMaster Filter RegEx question
3 asterisks is (apparently) simply the only placeholder for the first thing that was matched above.
^\[Ticket\#([0-9]{15})\] forces checking for a 15 digit number. I wonder if it will help.
Alternatively.. (ick)
^\[Ticket\#(\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d)\]
^\[Ticket\#([0-9]{15})\] forces checking for a 15 digit number. I wonder if it will help.
Alternatively.. (ick)
^\[Ticket\#(\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d)\]
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Re: PostMaster Filter RegEx question
Yes, it does, thanks for the suggestioncrythias wrote:3 asterisks is (apparently) simply the only placeholder for the first thing that was matched above.
^\[Ticket\#([0-9]{15})\] forces checking for a 15 digit number. I wonder if it will help.
Alternatively.. (ick)
^\[Ticket\#(\d\d\d\d\d\d\d\d\d\d\d\d\d\d\d)\]

Fortunately, for my purposes, this rule only needs to be implemented while we wind down the old OTRS system, plus the ticket numbering format is fixed at (in fact) 16 digits (so I modified what you had above.
It still seems a bit limiting though, as creating a backreference from [\d]+ is perfectly legal in regex. Perhaps I should raise a bug?
OTRS 3.2.11 on Centos 6.4 with MySQL 5.0. Agents and internal customers authenticate via Active Directory.