New RegEx command is nice feature

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

New RegEx command is nice feature

Post by Bob Hansen » Tue Mar 03, 2009 3:40 am

Just wanted to say thanks for the new RegEx command.

I just included it in my latest script.
I used the standard Perl syntax to extract a Firefox profile name.

Here is what I used:

Code: Select all

RegEx>^.* (\w.*).default,%vProfileName.txt%,0,match,num,1,$1,vProfileName
Not too complex, but I was able to extract this: h8ojjv0f
From this: [8]03/02/09 10:21 PM _____ _______ h8ojjv0f.default is the current profile

I was able to use my existing RegEx knowledge. Did not have to use VBScript, did not have to use EasyPatterns, did not have to use MidStr and Position. I was able to use the Replace feature with the grouping parenthesis.

I also suspect that as people start to use it, there will be many queries about the correct syntaxes to use to solve problems. Let me suggest that you might set up a separate Forum just to deal with RegEx.

Nice addition, lots of future use, thanks again.

----------------
Edited on 3/2/09 to add match,num, to the example. Although it worked with missing parameters, it caused a minor log file problem.
Last edited by Bob Hansen on Wed Mar 04, 2009 2:15 am, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Mar 03, 2009 10:03 am

Good stuff. Nice example of using a capturing group and using the captured value in the replace expression ...

I'm sure there will be lots of questions about RegEx now! I'm not entirely sure I'm ready for them. I'm no RegEx expert. Let's see what we get and if necessary we can set up a new forum later.

For those interested in using/learning about Regular Expressions I would not hesitate to recommend Jan Goyvaert's http://www.regular-expressions.info/ site. His RegEx Buddy tool is also very helpful for creating, testing and debugging expressions.

Also, the other day Bob sent me this recommendation in a PM:
And for those who are intimidated by the RegEx syntax, as I was for a long time, here is the best reference work available. I think it is relevant even with Easy Pattern formats to really understand the power of RegEx. Be sure to get the latest version, 3rd edition:

Mastering Regular Expressions, 3rd ed
Friedl, Jeffrey E F
O'Reilly, 2006
ISBN: 0-596-52812-4
http://regex.info/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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