(SOLVED) Postmaster filter problem with multiple parameters
Moderator: crythias
-
- Znuny expert
- Posts: 188
- Joined: 15 Dec 2014, 20:49
- Znuny Version: 4.0.24
- Location: QC, Canada
(SOLVED) Postmaster filter problem with multiple parameters
Hey all,
Im having a hard time configuring a postmaster filter to fill in some dynamic field value.
Here's a screenshot of my config: Here's the text regex i used:
.*GREAT.*size="1">([^\r\n\t\f<& ]+)
Here's a test example stuff to test:
Askdg8sb asoidaisd
<a href="http://www.w3schools.com/html/">GREAT blablabla size="1">12345</blablabal>
Apiusdiabusd
Asdiubadibus asipduhsadiuhdas
Tested my regex on http://www.regexplanet.com/advanced/perl/index.html and it all seems good but my dynamic field value aint set
Do you guys have any clue on how to make it work?
Thanks for your help!
Im having a hard time configuring a postmaster filter to fill in some dynamic field value.
Here's a screenshot of my config: Here's the text regex i used:
.*GREAT.*size="1">([^\r\n\t\f<& ]+)
Here's a test example stuff to test:
Askdg8sb asoidaisd
<a href="http://www.w3schools.com/html/">GREAT blablabla size="1">12345</blablabal>
Apiusdiabusd
Asdiubadibus asipduhsadiuhdas
Tested my regex on http://www.regexplanet.com/advanced/perl/index.html and it all seems good but my dynamic field value aint set
Do you guys have any clue on how to make it work?
Thanks for your help!
You do not have the required permissions to view the files attached to this post.
Last edited by wheelshot on 14 Nov 2016, 16:16, edited 1 time in total.
Re: Postmaster filter problem
How's your dynamic field defined?
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Postmaster filter problem
Does the Subject contain the term "# Test"? Is the mail a followup?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny expert
- Posts: 188
- Joined: 15 Dec 2014, 20:49
- Znuny Version: 4.0.24
- Location: QC, Canada
Re: Postmaster filter problem
Hi, here's the field definition which you'll find simple enough.ncmbu wrote:How's your dynamic field defined?
You do not have the required permissions to view the files attached to this post.
-
- Znuny expert
- Posts: 188
- Joined: 15 Dec 2014, 20:49
- Znuny Version: 4.0.24
- Location: QC, Canada
Re: Postmaster filter problem
Hi,reneeb wrote:Does the Subject contain the term "# Test"? Is the mail a followup?
Yes, im working on a dev instance so I send myself the email as test and it has the specified filter. If I do remove the regex and just run the filter to lets say move the ticket in a specific queue its working.
Its not a followup mail. Its a new ticket email with no #ticket.
Thanks for your help
-
- Znuny expert
- Posts: 188
- Joined: 15 Dec 2014, 20:49
- Znuny Version: 4.0.24
- Location: QC, Canada
Re: Postmaster filter problem
Bump! Anyone ? Thanks for your help
-
- Znuny expert
- Posts: 188
- Joined: 15 Dec 2014, 20:49
- Znuny Version: 4.0.24
- Location: QC, Canada
Re: Postmaster filter problem
Ok got my first bug hehe ! I took literally [...] from the example in the set value for the email header which is bad. Im now using [0] and its working with 1 parameter.
Next bug is that I wanna capture more than one parameter from the body.
I've built a regex using an online tool and I concluded with :
<GREAT[^>].*size=\"1\">([^\r\n\t\f<& ]+)<\/GREAT>.*<PIZZA[^>].*size=\"1\">([^<]+)<\/PIZZA>
Thing is that for this to work, i need the regex to be multiline (/s). Is that possible with OTRS postmaster filters?
Next bug is that I wanna capture more than one parameter from the body.
I've built a regex using an online tool and I concluded with :
<GREAT[^>].*size=\"1\">([^\r\n\t\f<& ]+)<\/GREAT>.*<PIZZA[^>].*size=\"1\">([^<]+)<\/PIZZA>
Thing is that for this to work, i need the regex to be multiline (/s). Is that possible with OTRS postmaster filters?
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Postmaster filter problem
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny expert
- Posts: 188
- Joined: 15 Dec 2014, 20:49
- Znuny Version: 4.0.24
- Location: QC, Canada
Re: Postmaster filter problem
AWESOME! Thanks reneeb I see that is for OTRS v5+. Is it available / compatible with OTRS v4.x?
Thanks again
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Postmaster filter problem
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny expert
- Posts: 188
- Joined: 15 Dec 2014, 20:49
- Znuny Version: 4.0.24
- Location: QC, Canada
Re: Postmaster filter problem
Ok i got it setup and here's how I've done it but it still getting empty fields:
Text regex: <GREAT[^>].*size="1">(?<s1>[^<]+)<\/GREAT>.*<PIZZA[^>].*size="1">(?<s2>[^<]+)</PIZZA>
Test email:
Subject: #TEST
Body:
Asoduygbas
Asdiuabsduibad
Aiusdbiausdsaiub
<GREAT.*size="1">P-2016-052</GREAT>
Asdasd
Asdadasd
<PIZZA.*size="1">siuabduiab iubsdiuabds iub asdiubs asdiubsadui</PIZZA>
sdadsas
Thanks for your help!
You do not have the required permissions to view the files attached to this post.
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Postmaster filter problem
try to use: (you have to replace <regex> with your actual regex) the "." does not match newlines... with the s modifier that behaviour is changed.
Code: Select all
(?ms:<regex>)
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny expert
- Posts: 188
- Joined: 15 Dec 2014, 20:49
- Znuny Version: 4.0.24
- Location: QC, Canada
Re: Postmaster filter problem
It worked great ! Thanks a lot!reneeb wrote:try to use:(you have to replace <regex> with your actual regex) the "." does not match newlines... with the s modifier that behaviour is changed.Code: Select all
(?ms:<regex>)