Topic: A search and replace that works only as edit (1 of 9), Read 33 times
Conf: VEDIT Macro Language Support
From: Al Fairweather
Date: Monday, April 14, 2008 07:09 PM

Got a file full of lines like this (all on one line)
"Herrn","Max","Mustermann","avec la Floozie","ImageWorks","Dream On 2","Wellville","94000","NOWHERE"

I need to merge the 8th (zip) and 9th (town field with four space between

"Herrn","Max","Mustermann","avec la Floozie","ImageWorks","Dream On 2","Wellville","94000 NOWHERE"

The zip codes will all start '94'

An edit with ^{.*94[0-9][0-9][0-9]}{","} in the search field
and \1 <-four spaces in the replace with Regexp max ticked works nicely.

Why does replace in a macro fail with MISSING LABEL: }:

Thanks

 


Topic: A search and replace that works only as edit (2 of 9), Read 21 times
Conf: VEDIT Macro Language Support
From: Ian Binnie
Date: Monday, April 14, 2008 09:57 PM

On 4/14/2008 7:09:17 PM, Al Fairweather wrote:
>Got a file full of lines like
>this (all on one
>line)
"Herrn","Max","Musterman
>n","avec la
>Floozie","ImageWorks","Dream
>On
>2","Wellville","94000","NOWHER
>E"

I need to merge the 8th
>(zip) and 9th (town field with
>four space
>between

"Herrn","Max","Muster
>mann","avec la
>Floozie","ImageWorks","Dream
>On 2","Wellville","94000
>NOWHERE"

The zip codes will
>all start '94'

An edit with
>^{.*94[0-9][0-9][0-9]}{","} in
>the search field
and \1
><-four spaces in the replace
>with Regexp max ticked works
>nicely.

Why does replace in a
>macro fail with MISSING LABEL:
>}:

We can't help with a macro when you don't tell us what is in it.

PS You should use '(' ')' rather than '{' '}'

Try:-
Replace('^(.*94[0-9][0-9][0-9])","','\1 ',BEGIN|MAX|REGEXP|NOERR)

It is a good idea to put the following at the start of a macro to avoid problems with line wrapping:-
Config( D_DSP_WRAP, 0,LOCAL ) // Needed to capture end of long lines

 


Topic: A search and replace that works only as edit (4 of 9), Read 24 times
Conf: VEDIT Macro Language Support
From: Al Fairweather
Date: Wednesday, April 16, 2008 01:16 PM

On 4/14/2008 9:57:03 PM, Ian Binnie wrote:
>On 4/14/2008 7:09:17 PM, Al Fairweather
>wrote:
>>Got a file full of lines like
>>this (all on one
>>line)
>"Herrn","Max","Musterman
>>n","avec la
>>Floozie","ImageWorks","Dream
>>On
>>2","Wellville","94000","NOWHER
>>E"
>
>I need to merge the 8th
>>(zip) and 9th (town field with
>>four space
>>between
>
>"Herrn","Max","Muster
>>mann","avec la
>>Floozie","ImageWorks","Dream
>>On 2","Wellville","94000
>>NOWHERE"
>
>The zip codes will
>>all start '94'
>
>An edit with
>>^{.*94[0-9][0-9][0-9]}{","} in
>>the search field
>and \1
>><-four spaces in the replace
>>with Regexp max ticked works
>>nicely.
>
>Why does replace in a
>>macro fail with MISSING LABEL:
>>}:
>
>We can't help with a macro when you
>don't tell us what is in it.

I'd assumed that you could work out from the above what I'd used.

replace("^{.*94[0-9][0-9][0-9]}{","}","\1 ",REGEXP)
>
>PS You should use '(' ')' rather than
>'{' '}'

Ah, my VEDIT three point something roots showing.
>
>Try:-
>Replace('^(.*94[0-9][0-9][0-9])","','\1
>',BEGIN|MAX|REGEXP|NOERR)

I'm afraid your suggestion didn't produce, I'll clarify that, it produced no error message, no cursor movement and certainly no desired result.

>It is a good idea to put the following
>at the start of a macro to avoid
>problems with line wrapping:-
>Config( D_DSP_WRAP, 0,LOCAL ) // Needed
>to capture end of long lines

Yes, I'd added that too, just in case.

I even paid my fifty bucks and upgraded to 6.11 (from 6.04) and didn't get anywhere.

I should add that the problem is now somewhat academic since I used a competing European product which I learned enough to solve the automation problem in a fraction of the time I've spent p****ing about with VEDIT.

My twenty year or so faith in VEDIT being the shiny tool in my tool-box of text problem solvers has however been seriously dented.

fw

 


Topic: A search and replace that works only as edit (5 of 9), Read 22 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Wednesday, April 16, 2008 03:46 PM

On 4/16/2008 1:16:44 PM, Al Fairweather wrote:
>
>Why does replace in a
>macro fail with MISSING LABEL:}:

Ted explained it.
Probably you used the wrong string delimiters.


>I'd assumed that you could work out
>from the above what I'd used.

??? Strange way to ask for help.


Ian Binnie suggested this:

Replace('^(.*94[0-9][0-9][0-9])","','\1 ',BEGIN|MAX|REGEXP|NOERR)

I tried it. That is working fine with your example data.
And it shows the correct usage of string delimiters.

>I should add
>that the problem is now somewhat
>academic since I used a competing
>European product which I learned enough
>to solve the automation problem in a
>fraction of the time I've spent p****ing
>about with VEDIT.

It's fun to help people here in the forum, indeed.


Christian

 


Topic: A search and replace that works only as edit (6 of 9), Read 22 times
Conf: VEDIT Macro Language Support
From: Al Fairweather
Date: Wednesday, April 16, 2008 08:02 PM

On 4/16/2008 3:46:08 PM, Christian Ziemski wrote:
>On 4/16/2008 1:16:44 PM, Al Fairweather
>wrote:
>>
>>Why does replace in a
>>macro fail with MISSING LABEL:}:
>
>Ted explained it.
>Probably you used the wrong string
>delimiters.

Yes, the following line works nicely

replace(:{.*94[0-9][0-9][0-9]}",":,:\1 :,REGEXP|MAX)

using a colon as a delimiter seems strange but it works, what doesn't work is using brackets '()' for the collection of the REGEXP term, I need braces '{}'. (You don't need the '^' to mark the start of the line either)

Thanks to all for your help.

fw

 


Topic: A search and replace that works only as edit (7 of 9), Read 21 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Thursday, April 17, 2008 02:29 AM

On 4/16/2008 8:02:06 PM, Al Fairweather wrote:
>Yes, the following line works nicely

replace(:{.*94[0-9][0-9][0-9]}",":,:\1 :,REGEXP|MAX)

>what doesn't work is using
>brackets '()' for the collection of the
>REGEXP term, I need braces '{}'.


Your Vedit 6.11 doesn't have the '( )':

From the online help of version 6.15:

-- Groups and Replacement Strings
--
-- The parentheses "(" and ")" group regular expressions for reference purposes.
-- They permit the text matched by the expression within "()" to be referenced again
-- in the search string or to be included as part of the replacement text.
--
-- Note: In versions prior to VEDIT 6.15, the characters "{" and "}" were used for groups.
-- For backward compatibility, they can still be used in version 6.15,
-- but this will be discontinued in version 6.2. You should therefore use parentheses "()"
-- for groups, as is now standard in Unix, Linux and Perl.

Christian

 


Topic: A search and replace that works only as edit (8 of 9), Read 21 times
Conf: VEDIT Macro Language Support
From: Pauli Lindgren
Date: Thursday, April 17, 2008 07:17 AM

On 4/16/2008 1:16:44 PM, Al Fairweather wrote:


> I even paid my fifty bucks and upgraded to 6.11 (from 6.04)
>and didn't get anywhere.

That is strange. If you upgrade, shouldn't you get the latest version (6.15.2)? And upgrading from 6.0 to 6.1 is only $29.

The version number is important, since the syntax of regular expressions has changed. The () grouping does not work in V6.11.

--
Pauli

 


Topic: A search and replace that works only as edit (9 of 9), Read 26 times
Conf: VEDIT Macro Language Support
From: Al Fairweather
Date: Thursday, April 17, 2008 02:29 PM

On 4/17/2008 7:17:24 AM, Pauli Lindgren wrote:
>On 4/16/2008 1:16:44 PM, Al Fairweather
>wrote:
>
>
>> I even paid my fifty bucks and upgraded to 6.11 (from 6.04)
>>and didn't get anywhere.
>
>That is strange. If you upgrade,
>shouldn't you get the latest version
>(6.15.2)? And upgrading from 6.0 to 6.1
>is only $29.

OK, partly my fault with terminology, I renewed my SSP for the fifty plus bucks because *I know, deep in my heart that - Ted needs the money, no sorry, that should read 'Vedit is very good value'*. I'd expected to get 6.15 too but didn't, however with the new serial number I was able to download 6.15 together with the manuals and learned that the VEDIT version of REGEXP is moving closer to the Perl standard.

The move to 6.15 brings FTP which should remove the need for the European product I've used in the past for those quick fix web-page jobs where somebody has pointed out I can't spell.

>The version number is important, since
>the syntax of regular expressions has
>changed. The () grouping does not work
>in V6.11.

Yeap, I can confirm that ;-)

fw.

 


Topic: Re: A search and replace that works only as edit (3 of 9), Read 26 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Tuesday, April 15, 2008 04:53 PM

At 03:06 AM 4/15/2008, you wrote:
>From: "Al Fairweather"
>
>Got a file full of lines like this (all on one line)
>"Herrn","Max","Mustermann","avec la Floozie","ImageWorks","Dream On 2","Wellville","94000","NOWHERE"
>
>I need to merge the 8th (zip) and 9th (town field with four space between
>
>"Herrn","Max","Mustermann","avec la Floozie","ImageWorks","Dream On 2","Wellville","94000 NOWHERE"
>
>The zip codes will all start '94'
>
>An edit with ^{.*94[0-9][0-9][0-9]}{","} in the search field
>and \1 <-four spaces in the replace with Regexp max ticked works nicely.
>
>Why does replace in a macro fail with MISSING LABEL: }:

Make sure that you use delimiters in the Replace() command which do not occur in the search string. Most punctuation can be used, just pick one.

Ted.