On 6/26/2014 12:32 PM, darren@xxxxxxxxx wrote:
That's great information. It should also get me started on understanding
how to do other things to mass replace. Thank you Buck.

Before I used regular expression searches I had no idea why I'd ever
want to. Now, I can't imagine searching without them. It does take
some time to get in the groove, but regular expressions are very powerful.

The more I use regular expressions, the more things I find I can do with

From: Buck Calabro
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

'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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.