Postmaster filter matching field value from email

Moderator: crythias

Post Reply
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Postmaster filter matching field value from email

Post by wheelshot »

Hi,

Im trying to setup a new postmaster filter that would gather information from the body of a ticket and set some information in a dynamic field.

I tried some of the stuff from that topic: viewtopic.php?f=53&t=18438 but cant seem to make it work for me.

Here's what I got to make it the simple I can:
2016-05-12 16_40_20-PostMaster Filters - Admin - OTRS - Maxthon Cloud Browser 4.9.2.1000 - max4web.png
But nothing is being placed in the dynamic field. I might just try to remove the tab from the text (\t) and see if thats whats messing with my regex.

Here's a sample of what im receiving:

PAVILLON G10
NUMERO_DE_CHAMBRE 0000
MOMENT_DE_LA_VERIFICATION Départ
PORTE_DE_CHAMBRE Fonctionnelle
PLAFOND Bon état
MURS Bon état
PLANCHER Bon état
DETECTEUR_DE_FUMEE Présent

So basically, what I want in my field is the "0000".

Can anyone help me? I check in the OTRS docs and posts in here but I cant understand it.

Thanks!
You do not have the required permissions to view the files attached to this post.
reneeb
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 matching field value from email

Post by reneeb »

Remove the leading and trailing "/" in the filter
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
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter matching field value from email

Post by wheelshot »

reneeb wrote:Remove the leading and trailing "/" in the filter
Tried it but not working still.

Could it be cause of the \t and the text that is submitted and the email received is being converted from tab to spaces?
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter matching field value from email

Post by wheelshot »

wheelshot wrote:Could it be cause of the \t and the text that is submitted and the email received is being converted from tab to spaces?
Answer = No, its not cause of the tab being converted as spaces.

Changed my regex to "NUMERO_DE_CHAMBRE\s(\S*)" and still got the same result.

I know the filter condition works cause im seeing it in the syslog but it sets '' in my dynamic field. Are there any regex wildcards I cant use? Is \S usable in OTRS?

Used the other alternative I found "NUMERO_DE_CHAMBRE\s([^\r\n\t\f ]*)" and this time I get " " (All white spaces). I dont understand cause when I test my regex in websites I get the right result.

Can anyone help?
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Postmaster filter matching field value from email

Post by wheelshot »

YEAH !

Got it ! My regex was the bug but I still dont know why thought.

My regex that works is "NUMERO_DE_CHAMBRE[\r\n\t\f ]+([^\r\n\t\f ]+)"

So anyone can explain me why \s and \S wont work in OTRS?
Post Reply