Matching strings containing "/"

35 views
Skip to first unread message

nmyshkin

unread,
Jul 4, 2024, 6:44:08 PM (4 days ago) Jul 4
to Tasker
I seem to have run into some kind of rule that I don't know about. Here are the two variables I am trying to compare:

%ScreensaverFolder = /system/media/screensaver/nature
%Folderlist2 = /system/media/screensaver/nature

They are identical (I've checked for hanging spaces), but they are not evaluated as identical in the simple If condition "Match". If I remove the "/" characters, the strings are evaluated correctly as identical.

I could do that, but it won't be pretty since %Folderlist2 is always changing, sometimes with a "1" at the end, or a "2", or a "3", etc.

I've noticed the "Matches Regex" option but can't see how it works. Not even sure if that will solve the problem.

Any pointers?

aa6vh

unread,
Jul 5, 2024, 11:48:54 AM (3 days ago) Jul 5
to Tasker
As far as I can tell, there is no way to escape the "/" character for the compare.

Two ways I can think of: Dip into Javascript to perform the compare, or do a tasker Variable Replace "/" with "^" and do the comparison using the new string(s).

There may be more clever ways out there though.

Rich D

unread,
Jul 5, 2024, 1:06:43 PM (3 days ago) Jul 5
to Tasker Google Groups Post
If you're looking for an exact match you can use the Equals condition.

The regex is a definite option as well,  you can use the chatbot. To get the proper structure..
Reply all
Reply to author
Forward
0 new messages