Regex help

Post your questions and help other users.

Moderator: Martin

Post Reply
Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Regex help

Post by Wibbly » 07 Sep 2019 21:20

I'm trying to trigger using Notification on Statusbar Displayed when the content of the notification does not contain the text "Location sharing in progress". I'm trying to use 'regex matches' with

^((?!^Location sharing in progress$).)*$

but it's not triggering.

Anyone have any ideas why not, or a better way of doing this?
Last edited by Wibbly on 10 Sep 2019 10:38, edited 1 time in total.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Regex help

Post by Desmanto » 08 Sep 2019 15:40

I tried the regex in regex tester, it should be working if the text is exactly NOT "Location sharing in progress".
But your app notification might put additional space or newline (\n) after the text. Even a single additional char will make the regex fail.
Try to use debug dialog, let it match all and put debug dialog after the notification trigger. Copy the value of the notification content and paste it regex tester to be sure.
If there is additional space or newline, you should see it there.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: Regex help

Post by Wibbly » 08 Sep 2019 17:51

Thanks. I found it never fires even with very different strings. But I found a workaround with a separate condition that uses a script that works.

Post Reply