That's great information. It should also get me started on understanding
how to do other things to mass replace. Thank you Buck.
From: Buck Calabro <kc2hiz@xxxxxxxxx>
To: wdsci-l@xxxxxxxxxxxx
Date: 06/26/2014 09:41 AM
Subject: Re: [WDSCI-L] Mass replace exsr with callp ()
Sent by: "WDSCI-L" <wdsci-l-bounces@xxxxxxxxxxxx>
On 6/25/2014 4:04 PM, darren@xxxxxxxxx wrote:
That replaces the exsr $Main great, thanks. I guess I need to read up on
how regular expression work, since I want to replace all of the exsr, and
not just $Main.
Try this:
findText all regularExpression replaceWith "callp $1()" "exsr
(\\S*)"
'all' means to replace all occurrences.
the replaceWith includes the proper spacing between the opcode and
factor 2. The special thing there is the '$1' - this says to insert the
code stored in regex group 1. More in a moment. The '()' is just
parens to tack on to the end of the former subroutine name.
The search string searches for exsr and the proper number of spaces
between the opcode and factor 2. Then, it lumps the next bit of text
into group 1 - that's what the parens mean here inside the search
string. There is a special search term that means 'anything but white
space' and that is '\S' (the capital S is important). Of course,
backslash is a special character; it is the 'escape' character. As
such, it needs to be escaped. With a backslash. This is similar to the
apostrophe in RPG. "10 O'Clock" needs to be written '10 O''Clock'.
Anyway. The * after the \\S means 'any number of those'.
So the regex is looking for exsr, 6 spaces and then any number of
non-blank characters.
Hope that helps. You can use this in the Find dialogue box as well
(Ctrl-F) but I'm old fashioned.
--buck
--
This is the Rational Developer for IBM i / Websphere Development Studio
Client for System i & iSeries (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/wdsci-l.
As an Amazon Associate we earn from qualifying purchases.