Topic: Fix old regular expressions groups (1 of 4), Read 40 times
Conf: VEDIT Macro Library
From: Ian Binnie
Date: Thursday, July 20, 2006 09:23 PM

Forum users may be interested in the following simple macro to change macros that use regular expressions to "( )" groups.

I though of an automated process, but decided this was too risky.

I first did a Wildcard search for {|*}|*REGEXP
then opened each file in search.tmp and ran the macro.

This finds lines with old regular expressions groups, then changes them.
Only one line is changed at a time, and the string is left highlighted to allow manual inspection of the change.


// Change to 6.15 Reg Exp groups
// Ian Binnie 2006-07-21
Search("{|*}|*REGEXP",CONFIRM|ERRBREAK)
Replace_block("{","(",BB-1,BE,BEGIN|ALL)
Replace_block("}",")",BB,BE,BEGIN|ALL)
Goto_Pos(BE)

 


Topic: Re: Fix old regular expressions groups (2 of 4), Read 38 times
Conf: VEDIT Macro Library
From: Ted Green
Date: Monday, July 24, 2006 09:47 PM

At 09:23 PM 7/20/2006, you wrote:
>Forum users may be interested in the following simple macro to change macros that use regular expressions to "( )" groups.

Thank you; that should be useful as we will drop the old "{ }" group support in the next version.

Ted.

 


Topic: Fix old regular expressions groups (3 of 4), Read 31 times
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Friday, September 15, 2006 01:52 PM

On 7/20/2006 9:23:17 PM, Ian Binnie wrote:
>
>Search("{|*}|*REGEXP",CONFIRM|ERRBREAK)
>Replace_block("{","(",BB-1,BE,BEGIN|ALL)
>Replace_block("}",")",BB,BE,BEGIN|ALL)
>Goto_Pos(BE)

I think you need to first change "(" into "\(" and ")" into "\)".
After that, you can change {...} into (...).

--
Pauli

 


Topic: Fix old regular expressions groups (4 of 4), Read 29 times
Conf: VEDIT Macro Library
From: Ian Binnie
Date: Saturday, September 16, 2006 03:52 AM

On 9/15/2006 1:52:10 PM, Pauli Lindgren wrote:
>On 7/20/2006 9:23:17 PM, Ian Binnie
>wrote:
>>
>>Search("{|*}|*REGEXP",CONFIRM|ERRBREAK)
>>Replace_block("{","(",BB-1,BE,BEGIN|ALL)
>>Replace_block("}",")",BB,BE,BEGIN|ALL)
>>Goto_Pos(BE)
>
>I think you need to first change "("
>into "\(" and ")" into "\)".
>After that, you can change {...} into
>(...).
>
>--
>Pauli
>
If you have "(" or ")" in your Reg Exp (which I didn't) this would be a good idea, and certainly do no harm even if you don't.

As I pointed out in my original post, it was not my intention to fully automate the process, but to change each Reg Exp one at a time to allow inspection.

My first changes (manual) missed a couple.
The real point of the post was to suggest a process to find and highlight the Reg Exp which needed to change.

The macro would then become:-

Search("{|*}|*REGEXP",CONFIRM|ERRBREAK)
Replace_block("(","\(",BB-1,BE,BEGIN|ALL|NOERR)
Replace_block(")","\)",BB-1,BE,BEGIN|ALL|NOERR)
Replace_block("{","(",BB-1,BE,BEGIN|ALL)
Replace_block("}",")",BB,BE,BEGIN|ALL)
Goto_Pos(BE)