Topic: macro replace command (1 of 2), Read 16 times
Conf: VEDIT Macro Language Support
From: John M. Joslin III
Date: Wednesday, February 18, 2009 12:09 PM

I need to replace the first occurrence of a character in each line of the document. IE, replace ""|009"" in the line if it is the first thing in the line and then go to the next line. In this particular application, I want to replace the tab character "|009" with the appropriate number of characters but only if the tab character is in the first position on the line. The manual says that you can use "count,1" but I think this applies to the entire document not line by line.

Is it possible to specify the column position in the line, or whatever, in order to change the first occurrence only?

Thanks,

John

 


Topic: Re: macro replace command (2 of 2), Read 18 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Wednesday, February 18, 2009 12:22 PM

At 12:09 PM 2/18/2009, vedit-macro-language Listmanager wrote:
>From: "John M. Joslin III"
>
>I need to replace the first occurrence of a character in each line of the document. IE, replace ""|009"" in the line if it is the first thing in the line and then go to the next line. In this particular application, I want to replace the tab character "|009" with the appropriate number of characters but only if the tab character is in the first position on the line. The manual says that you can use "count,1" but I think this applies to the entire document not line by line.
>
>Is it possible to specify the column position in the line, or whatever, in order to change the first occurrence only?

John:

There are several ways to do this:

* Perhaps the easiest is to search for: |<|009

* The Replace_Block() command could be used with the COLUMN or COLSET options, but that seems an overkill in this case.

Ted.