VoxCommando Forum

Help and Support (Using VoxCommando) => VoxCommando Basics and Core Features => Topic started by: Telorast on November 02, 2012, 10:07:00 AM

Title: Need help with Results.RegEx
Post by: Telorast on November 02, 2012, 10:07:00 AM
I'm trying to get the computer to tell me the weather and wunderground returns a nice text string that I'm trying to use. But I'm not interested in the wind conditions so I'm trying to trim that bit off but I can't figure out how to get Results.RegEx to match properly.

To test it I wrote this macro that sets last result, try to match the wind part and then replace it with a space character:

Results.SetLastResult     Overcast in the morning, then mostly cloudy. Winds from the South at 15 to 20 km/h.
Results.RegEx               (Wind.*)
Results.Replace             {match.1} && " "
OSD.ShowText             {lastresult}

Wanted result: "Overcast in the morning, then mostly cloudy.  "
Seen result:     "Overcast in the morning, then mostly cloudy. Winds from the South at 15 to 20 km/h."

It doesn't work and I can't figure out why. Tried lots of expressions but nothing seems to match.
Title: Re: Need help with Results.RegEx
Post by: jitterjames on November 02, 2012, 11:40:29 AM
Hi Telorast.

Welcome to the community and thank-you for your question.  I'm not 100% sure why your method is not working, but I can tell you the easier way to do it that works.

Instead of using two actions:

Results.RegEx...
Results.Replace...


use one action:

Results.RegExReplace    (Wind.*)

and leave the 2nd param blank.

I don't know all the possible strings that WUnder could return so I don't know if anything more sophisticated would be required to keep possibly useful information that comes after Wind... but this should get you on the right track.
Title: Re: Need help with Results.RegEx
Post by: Telorast on November 02, 2012, 09:16:23 PM
Thanks, somehow the same expression matched in RegExReplace.