AutoVoice regex mixing named/unnamed capturing groups

290 views
Skip to first unread message

Manu Pinazo

unread,
Jul 31, 2013, 2:13:49 AM7/31/13
to joao...@googlegroups.com
Hi, first of all thanks for this nice set of tasker plugins/apps :-)

Possibility to use named capturing groups in AV regex expressions is really cool, however I think I found a bug when mixing named and unnamed groups:
Say for example this regex: (I want to|let's) (?<command>.+)
If in the task I show a toast with %command and then I test saying "I want to sleep" the toast will show "I want to" when the correct thing will be "sleep".

I think the unnamed groups should be passed to the task actions as an array of variables as well, let's say %avreg1, %avreg2 (AutoVoice Regular Expression Group)

Manu Pinazo

unread,
Jul 31, 2013, 2:33:43 AM7/31/13
to joao...@googlegroups.com
BTW I forgot to say that a simple workaroud is to name all the groups, like so: (?<waste>I want to|let's) (?<command>.+)

João Dias

unread,
Jul 31, 2013, 3:17:42 AM7/31/13
to joao...@googlegroups.com
Hi!

Yes, I've documented this constraint here: http://joaoapps.com/autovoice/variables/

Thanks for mentioning it though!

João


--
You received this message because you are subscribed to the Google Groups "joaomgcd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joaomgcd+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Juan Luis

unread,
Jul 31, 2013, 11:28:39 AM7/31/13
to joao...@googlegroups.com
Hi joao and Manu

joao I tried what Manu says is right

Example use regex (hello|hi) (?<proof>.+)
when you say "hi joao" <proof> is equal joao in the theory but With This regex proof is equal to "hello" Manu and me thinks is a bug.

João Dias

unread,
Aug 2, 2013, 7:11:48 PM8/2/13
to joao...@googlegroups.com
Yes Juan, I'm aware thanks :)

It's just how I set it up. If you want to use named groups, then you should name ALL groups.

Maybe I'll change this in a future version.

Thanks!


--

Manu Pinazo

unread,
Aug 6, 2013, 6:17:19 AM8/6/13
to joao...@googlegroups.com
It would be nice if this is solved in the future because sometimes you need groups for some regexes to work but don't really need their content.

Meanwhile I found another workaround that needs less typing and results in shorter regexes too: using non-capturing groups with ?:
This of course is only valid for groups where the captured value isn't needed (otherwise use named groups).

The documentation example “(?<play>play|put on) a movie by (?<actor>.+)” could be rewritten like this if you only need the actor:
“(?:play|put on) a movie by (?<actor>.+)” and would be correctly handled by AutoVoice.
Reply all
Reply to author
Forward
0 new messages