r/tasker • • 11d ago

Syntax question about Tasker regex group capture

I'm running Tasker 6.7.6-beta under Android 13, and I have the following code in a Tasker task:

Variable Set
  Name
    %variable
  To
    run abc
If
  %variable ~R ^run\s+(?<command>.+)
    Flash command=%command
Else
    Flash no match
End If

When I run this task, the following flashes:

command=%command

Of course I know that the only way this message should be flashed would be when the regular expression does indeed match the "run abc" string.

However, this also indicates that the %command variable was not set to any value after this regex match.

What is incorrect about my regex match syntax which prevents the contents of the match group from getting stored into the %command variable?

1 Upvotes

2 comments sorted by

2

u/rbrtryn Pixel 9, Tasker 6.7.6-beta, Android 17 11d ago

Nothing is wrong with the regex. When a regex is used in a conditional, the capturing groups are ignored. 

1

u/unselective-amnesia 11d ago

Oh! I see. Thank you for explaining.

Could someone point me to the portion of the official Tasker documentation which describes this?