For simple editing commands, numbered back references are very convenient, but 
for complicated parsing it becomes difficult to keep track of who did what to 
whom; at that point named captures are crucial. I use both. Alas, the regex 
syntax in TSPF is not the same as in ISPF, neither is the same as in Perl, ... 
As George Mealy said: "Standards are wonderful things; everyone should have one 
of their own."

Stems are good; use the same stem for numbered and named captures.

     /(\d+) \s+ (foo=(?<FOO>[abc]+)|bar=(?<BAR>[def]+) \s/i

would populate stem.1, stem.2 and either stem.FOO or stem.BAR.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3

________________________________________
From: IBM Mainframe Assembler List [[email protected]] on behalf 
of Paul Gilmartin [[email protected]]
Sent: Tuesday, February 22, 2022 10:03 PM
To: [email protected]
Subject: Re: Interpreting Explicit Decimal Numbers

On Feb 22, 2022, at 18:59:06, Seymour J Metz wrote:
>
> Back-references are certainly essential, but for complicated expressions 
> assertions, named captures, etc., make life easier.
>
For substituting in a string, as in sed or vi, numbered back-references
Work well enough.  Otherwise the programmer needs to define labels.

For assignment to variables names are proper.  But how about supplying
a stem and letting regex assign to numbered members?  The programmer
might supply synonyms, as in SYSCALL_CONSTANTS.

ISPF Edit Change should allow replacement strings containing
back-references.

> ________________________________________
> From: Paul Gilmartin
> Sent: Tuesday, February 22, 2022 12:37 PM
>
> I'd be reasonably satisfied with POSIX ERE and back-references optionally 
> assigned to Rexx variables.
>
> --
> gil

--
gil

Reply via email to