How to use regex in postamster filter

Hi, We are trying to use regex in postmaster filter, but is doesn't work. I don't know if is it a bug, or we use it wrongly. We need to automaticaly close a ticket, which body contains a line with word "Closeable". Only this word is allow in the line. Sample email: To: test@example.com From: me@example.com Subject: This is a test for auto close Closeable Accounted time: 30 min This ticket can be closed. Regex what we are trying to use in postmaster filter: Filter condition: Check email header: Body Look for value: ^Closeable$ Set Email Headers: Set email header: X-OTRS-State Set value: closed successful We tried ^Closeable.*$ but it also doesn't work. ^Closeable works, but this also matches the line "Closeable or not closeable, that is the question...", but this is not allowed by our policy. Can anybody help? Regards, Balázs

I believe you're looking for X-OTRS-FollowUp-State
Without -FollowUp, the action applies if the ticket is newly created.
Otherwise, the state changes on FollowUp.
Also perhaps leading and/or trailing characters in the body like
#Closeable# might be useful. This would nearly guarantee to be found and
unambiguous as a keyword.
On Sat, Mar 18, 2017 at 1:33 PM, Úr Balázs
Hi,
We are trying to use regex in postmaster filter, but is doesn't work. I don't know if is it a bug, or we use it wrongly. We need to automaticaly close a ticket, which body contains a line with word "Closeable". Only this word is allow in the line.
Sample email:
To: test@example.com From: me@example.com Subject: This is a test for auto close
Closeable Accounted time: 30 min
This ticket can be closed.
Regex what we are trying to use in postmaster filter:
Filter condition: Check email header: Body Look for value: ^Closeable$
Set Email Headers: Set email header: X-OTRS-State Set value: closed successful
We tried ^Closeable.*$ but it also doesn't work. ^Closeable works, but this also matches the line "Closeable or not closeable, that is the question...", but this is not allowed by our policy.
Can anybody help?
Regards, Balázs --------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/mailman/listinfo/otrs

2017-03-19 0:12 GMT+01:00 Gerald Young
I believe you're looking for X-OTRS-FollowUp-State
Yes, sorry. It was a typo. Of course, we use X-OTRS-FollowUp-State. My question is about regex. Using leading and/or trailing character is technically possible, but practically not because of the users. They are not programmer, and don't understand why have to use leading and/or trailing character. And if they forget to type these characters, the regex will also not work. Regards, Balázs

Try (?m:^Closeable$) - Renée Am 18.03.2017 um 18:33 schrieb Úr Balázs:
Hi,
We are trying to use regex in postmaster filter, but is doesn't work. I don't know if is it a bug, or we use it wrongly. We need to automaticaly close a ticket, which body contains a line with word "Closeable". Only this word is allow in the line.
Sample email:
To: test@example.com From: me@example.com Subject: This is a test for auto close
Closeable Accounted time: 30 min
This ticket can be closed.
Regex what we are trying to use in postmaster filter:
Filter condition: Check email header: Body Look for value: ^Closeable$
Set Email Headers: Set email header: X-OTRS-State Set value: closed successful
We tried ^Closeable.*$ but it also doesn't work. ^Closeable works, but this also matches the line "Closeable or not closeable, that is the question...", but this is not allowed by our policy.
Can anybody help?
Regards, Balázs --------------------------------------------------------------------- OTRS mailing list: otrs - Webpage: http://otrs.org/ Archive: http://lists.otrs.org/pipermail/otrs To unsubscribe: http://lists.otrs.org/mailman/listinfo/otrs
-- Perl / OTRS development: http://perl-services.de OTRS AddOn repository: http://opar.perl-services.de

2017-03-19 8:21 GMT+01:00 Renee B
Try: (?m:^Closeable$)
Thank you, it works! Explanation for myself (and for the list archive): ?m sets multiline matches (see: http://www.regextester.com/pregsyntax.html#AEN123893) Explanation of multiline modifier: http://php.net/manual/en/reference.pcre.pattern.modifiers.php Regards, Balázs
participants (3)
-
Gerald Young
-
Renee B
-
Úr Balázs