r/tasker•
Ratchet_Guy

[QUESTION] Anyone here familiar with Regular Expression matching in Tasker, specifically in Search/Match/Replace Action?

If Tasker would implement PCRE regular expressions correctly in Search/Match/Replace Action, things would be much easier.

The main issue is that it doesn't seem to support capturing vs. non-capturing groups as well as defining variables for groups. i.e.

So take a sentence such as: "Here are animals I like: cats,dogs,birds."

 (?:Here are animals I like\:\ )(?<list>.+)(?:\.)

Whereby you could then just have %list to be your value of "cats,dogs,birds" out of any giant chunk of text. Things like AutoVoice seem to have no problem matching Regex like these and generating the variables, but I don't think you can generate var names in regular ole' Tasker.

But almost just as good, again if Tasker could do it, would be to just be able to identify capturing groups from non-capturing. So if in Variable Search/Replace you used

(?:Here are animals I like\:\ )(.+)(?:\.)

Or if it's in a really big web page etc.

(?:Here are animals I like\:\ )([a-zA-Z,]{1,30})(?:\.)

 

And in %matches it would just return the capturing group in the middle, that woud be nice. But Tasker returns the whole damn thing i.e. "Here are animals.." and the rest, and then you still gotta split it at least once or twice or three times plus to get what you finally want.

Unless I'm missing something.

Posted May 26, 2015, 7:21 PM UTC · edited

36
Loading comments…