ISPF find using regular expressions is clever! But…

I had data like OWNER(colin) and wanted to replace the text like “colin” with some other text, regardless of the “colin” value.

I could do it in ISPF edit using

C “OWNER(COLIN)” “OWNER(REPLACE)”
C “OWNER(USER1)” “OWNER(REPLACE)” .

but this quickly got to be tedious. I found you can use regular expressions with ISPF find using regular expressions. Wikipedia says

A regular expression (shortened as regex or regexp), … is a sequence of characters that specifies a match pattern in text. Usually such patterns are used by string-searching algorithms for “find” or “find and replace” operations on strings, or for input validation.

Wikipedia

For example I could use

change rc”owner\(.*\)” “owner(replace)”

which says find the string

“owner” followed by “(” – \( is escaped and not interpreted, followed by zero or more characters, followed by ) - \) is escaped; and replace it with the string “owner(replace)”

What you can do with it

find rc”abc[0-9]” says find a string abc followed by one of the characters in the range 0 to 9 so abc9 is found, but find rc”abc[0-8]” would not find abc9.

But…

Your terminal needs to have the correct code page for square brackets.
If I use “U.S English Code page 37” it works. If I use “Bracket (CP 037 modified) Euro” it does not work.

With the “Bracket (CP 037 modified) Euro”  [ is displayed as Ý, and ] is displayed as ¨, and the ISPF code cannot find [ or ] and so cannot find the string