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!
Need help with regex / Notification on Statusbar
Moderator: Martin
Re: Need help with regex / Notification on Statusbar
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
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
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
You could also use glob ^^
Code: Select all
Urgent Ticket Notification (? - Open)*
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.
Re: Need help with regex / Notification on Statusbar
Bluscre wrote:You could also use glob ^^
Code: Select all
Urgent Ticket Notification (? - Open)*
Thank you!!! That did the trick!