Page 1 of 1

Listen for Regex

Posted: Tue Jan 25, 2022 4:55 pm
by Ivo
I know that regex support has already been mentioned in a thread, and noted as maybe too advanced for the typical user.
Either way, i'll try my luck with this request as maybe an advanced user :D

Example:
There would be a checkbox to activate Regex mode

Allowing the following:

open forge
open magic
play forge
play magic
start forge
start magic


as

(open|play) (forge|magic)

For * scenatios, no need to resolve as this comes free with regex:
calculator *
to
calculator .*

For $ scenarios, maybe using regex named groups:
search for $
to
search (?<q>\w+)

Maybe even allow multiple custom named group to be applied to the parameter input:
Listen for: (show|display) infobox (?<p1>\w+) and (?<p2>\w+) please
Parameters: infobox "first param <p1> and the second param <p2>"

Re: Listen for Regex

Posted: Tue Jan 25, 2022 5:41 pm
by RobLatour
Thanks for the suggestion Ivo, I understand why people might want it and appreciate you have seen where it was asked for before.

I'll need to give it some thought, but since version 3.6 complicating matters for regex implementation is Push2Run's ability to use separating works. For example:

OK Google, turn off my office light and shut down my computer

But in truth, the one thing that complicates matters the most for regex is me understanding it fully enough to get right :-)

In any case, I'll give it some thought once I get the next version (4.0) out the door.

Teaser alert 4.0 will support something new as a trigger!

Re: Listen for Regex

Posted: Thu Jan 27, 2022 3:06 pm
by RobLatour
Ivo

I seem to be having success adding in Regex support, but I will need to do some more testing.

Would you be willing to try out a beta and provide your feedback?

Re: Listen for Regex

Posted: Thu Jan 27, 2022 4:36 pm
by Ivo
I'll happily test out a beta and give feedback.
If you have some coding quesitons related to getting regex to work, I think I could also help.
I'm a PHP developer, from what I can tell the project is made in vb, but i'm sure it shouldn't be too complicated to implement.

Re: Listen for Regex

Posted: Thu Jan 27, 2022 4:39 pm
by RobLatour
OK, I will send you a link via e-mail shortly (I'm just doing some other changes right now and would like to square them away first).
(I have your e-mail from when you registered on this user forum)

Re: Listen for Regex

Posted: Thu Jan 27, 2022 4:47 pm
by Ivo
sounds good.

side note:
i'm in uk time zone, so there might be a possiblilty of me not responding today.

Re: Listen for Regex

Posted: Sun Jan 30, 2022 5:09 pm
by RobLatour
Ivo,

Thanks again very much for this suggestion and your help.

The changes for Regex matching, using the 'Listen for' field, as well as using regex group values from the 'Listen for' field within the 'Open', 'Parameters', and "Keys to send' fields is now supported in version 4.2 released today.

An example can be found here