RegEx Revisted

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

RegEx Revisted

Post by PepsiHog » Sun Jan 06, 2013 11:23 pm

Good day there, peeps.

So.....I was searching the forum and came upon this here script that was posted by Bob Hansen.

Code: Select all

Let>vNeedle=^.*IGNORE.*"([^"]*)".*(\b(PRESS|ENTER|TYPE)\b.*)WITHIN(.*)$
Let>vHaystack=IGNORE "Error !*Child" TYPE <F1> WITHIN 2
Let>vReplacement=Four Values are:%CRLF%1: $1%CRLF%2: $2%CRLF%3: $3%CRLF%4: $4
RegEx>%vNeedle%,%vHaystack%,0,MatchMe,cnt,1,%vReplacement%,vResult
MessageModal>%vResult%
And I started to study it. I think I have the jist of it, but not all. So maybe someone here can help further my understanding. Please.

The arguement is vNeedle. So this is my understanding of that.
Let>vNeedle=^.*IGNORE.*"([^"]*)".*(\b(PRESS|ENTER|TYPE)\b.*)WITHIN(.*)$

The carot is the beginning of the text being analyzed. The .* means everything before the word IGNORE and again, everything after.

The next part is "([^"]*)". The first quote I think means -up to the qoute- And then ([^"]*). Which argues not to include from the beginning to the quote. But to include everything else.(That's the *) So that result would be in $1. The next part argues from the second quote and everything else to find a word boundary. It's looking for three words - PRESS,ENTER, OR TYPE. So that would be $2. The next .* means and everything else.

Here is where I think I may be wrong. Why does $3 equal TYPE? Is it because it searches for word boundary + .* and then just for the word boundary?

The next part is WITHIN. Which I believe means -up to the word WITHIN-. And the last part means everything else. Which is 2.($4)

The $ marks the end of the string.

So how'd I do? Can anyone explain what I got right and what I got wrong?

Thanks for helping,
PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts