Jump to content
Macro Express Forums

Script to perform Regex operations?


Recommended Posts

@kunkel321

I recommend the approach I described, namely activating a program that does support Regex to accomplish your search/replace. I personally use TextPad but here's a page suggesting a dozen free tools:

https://stackoverflow.com/questions/132405/free-alternative-to-regexbuddy

Terry, East Grinstead, UK

Link to comment
Share on other sites

Thanks for the cool list Terry!  As it turns out, I do have a copy of RegExBuddy!  There are actually a few AHK-based regex testing tools as well.  The thing I'm not sure about is transparently sending the information back and forth between the applications.  

Interesting note:  I tried the method that Lemming put (previously on this same thread, 2010).  His MEp script did need one tweak...  In the step where you capture "sed.exe" you need to checkmark the "Capture Console Output" box.  Unfortunately, SED appears to have its own language....  It's taken me years to learn the small amount of regex, AHK, and MEp that I know.  I don't want to have to learn SED too!!!!  ;)    

Link to comment
Share on other sites

  • 3 years later...
On 7/24/2010 at 2:00 PM, lemming said:

Hi Terry, I've been testing GNU utilities for Win32 (unxutils.sourceforge.net), which includes classic Unix utilities like Grep, Sed, and Awk. These 3 support regular expressions, and I got them to work with Macro Express Pro.

 

For your text problem, I wrote an MEP script which calls Sed.

 

The MEP script is only 6 lines long - all it does is set a working folder, launch Sed, and report the results.

 

The Sed script which is doing the actual heavy lifting is only 3 lines long! (excluding comments)

 

All thanks to regex 😉

 

QUICK START

 

1. Download Run Sed.mex and Run Sed.zip from here

 

2. Unzip Run Sed.zip and put the 3 files (sed.exe, Sed_Script.txt, ExampleForCory.txt) into a folder which MEP can read. Take note of the folder path. Also note that Windows 7/Vista will block access to certain folders.

 

3. Import Run Sed.mex into Macro Express Pro

 

4. Change the WorkingFolder variable in the script to the full path of the folder which contains the 3 files from Step #2

 

5. Run the script, and it will process ExampleForCory.txt and report the results

 

The Sed_Script.txt file has comments which explain the Sed commands. I also learned a lot from this site:

 

Famous Sed One-Liners Explained

 

 

-Lemming

Run Sed.mex 1.89 kB · 20 downloads

Run Sed.zip 25.43 kB · 14 downloads

post-528-127997171406_thumb.png

Hello there

I wanted to try this method ... but the files aren't available any longer 😞.

Is there a solution to obtain it ... after all these years ?

 

Thank you for your answer

Link to comment
Share on other sites

1 hour ago, Juan-Pablo said:

Hello there

I wanted to try this method ... but the files aren't available any longer 😞.

Is there a solution to obtain it ... after all these years ?

 

Thank you for your answer

 

I assume you mean Lemming's two sed files (.mex and .zip) from nearly 13 years ago? If so, I was able to download both. What problem are you having.

 

 

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...