Hello,
I need help tryind to figure out the correct regExp for an especific filter.
This is the message I need to parse:
"..reporte # 12345678 se ha..." and I need to capture "12345678" and save it in a dymanic field.
I've tried (among many others options)
Filter condition
Header 1 - Body Value 1 : "reporte # (\d{8})"
Set email headers
Header 1 - X-OTRS-DynamicField-HMNumber Value 1 - [***]
I've alse been using https://regex101.com/ to try to match the expression with what I need.
Hope you can help me.
Thank you very much.
Body Filter - RegExp
Moderator: crythias
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Body Filter - RegExp
Start simple and see if you can match the numbers alone. Then extend the regexp.
Right now, my only idea would be to replace spaces with "\s" - I remember OTRS did have a problem somewhere with regexp and spaces.
Right now, my only idea would be to replace spaces with "\s" - I remember OTRS did have a problem somewhere with regexp and spaces.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Body Filter - RegExp
Thank you very much,
It worked just fine by replacing spaces with \s.
I'll try the way you suggest adding properties to my other regEXP.
Thanks RStraub!
It worked just fine by replacing spaces with \s.
I'll try the way you suggest adding properties to my other regEXP.
Thanks RStraub!
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Body Filter - RegExp
Ohey, this was easy
You're very welcome

Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Body Filter - RegExp
Hello, again, just for curiosity...
Looking for a better regular expression, nicer than the one I have
Text to parse--> "ant: name1 name2 name3 name4"
RegExp --> ant:\s(\w*\s\w*\s\w*\s\w*) (it works, but ick)
How can I express: from ":\s" to \n or \r ?
Thanks!
Looking for a better regular expression, nicer than the one I have
Text to parse--> "ant: name1 name2 name3 name4"
RegExp --> ant:\s(\w*\s\w*\s\w*\s\w*) (it works, but ick)
How can I express: from ":\s" to \n or \r ?
Thanks!

-
- 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: Body Filter - RegExp
\n or \r is
"[...]" is a so called character class
Code: Select all
[\n\r]
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