Page 1 of 1

Need help with regex / Notification on Statusbar

Posted: 06 Sep 2017 19:57
by chiph
I am trying to set up a new trigger for Notification on Statusbar Displayed, matching on Text. I am able to get it to match on 'contains text' but not matches regex. I have tested the regex, and am able to fully match the string. I'm sure I'm just entering it incorrectly (I'm just putting the regex on the line). The goal is to alert me when an email comes in with a fairly specific subject. The text I am trying to match is:

Urgent Ticket Notification (xxxxx - Open)

Where xxxxx = some integer. For example,

Urgent Ticket Notification (17001 - Open)

The regex I am using is:

^Urgent\sTicket\sNotification\s\(\d+\s-\sOpen\)

I am matching the beginning of the line because I don't want to get a match if someone forwards me the email, for example:

FW: Urgent Ticket Notification (xxxxx - Open)

Can someone tell me what I'm doing wrong and/or if there's a better regex I can use?

Thanks!

Re: Need help with regex / Notification on Statusbar

Posted: 06 Sep 2017 20:10
by Martin
Hi,

You can use action Scripts regular expression tester to see if your regular expression matches the text. Just create an empty action Script somewhere in a flow and press the Regular Expression Tester-button.
The text in the notification might contain some unexpected newlines or even some additional text so I recommend to use a condition Debug Dialog to see if the regular expression has to be extended in some way.
Maybe you have to enable DOTALL mode (single line mode) with (?s) in front of the pattern to let . also match newline characters.

Regards,
Martin

Re: Need help with regex / Notification on Statusbar

Posted: 07 Sep 2017 13:33
by chiph
Thanks Martin - that Debug Dialog was exactly what I needed. The regex tester was giving me a match, but it turns out that there's a lot more inside the notification than I had realized. I've got a lot to go on now. I appreciate it!

Re: Need help with regex / Notification on Statusbar

Posted: 07 Sep 2017 14:09
by Bluscre
You could also use glob ^^

Code: Select all

Urgent Ticket Notification (? - Open)*

Re: Need help with regex / Notification on Statusbar

Posted: 13 Sep 2017 19:13
by chiph
Bluscre wrote:You could also use glob ^^

Code: Select all

Urgent Ticket Notification (? - Open)*

Thank you!!! That did the trick!