On Mon, 1 May 2023 23:30:51 +0000, Frank Swarbrick wrote: > ... >But it doesn't work for a PDS member to following, also surrounded by >parentheses: > >Test2: PARENS COBOL(TEST(MEMBER)) >Results2: >COBOL >TEST(MEMBER > >Any simple REXX parse option to handle this, or do I need to resort to more >complex REXX? Or do I just add a trailing paren if there is a leading one in >valueOpt? Perhaps that's the simples answer. > A tough one. Can PCRE do this? Does REXX support PCRE nowadays? Maybe OoRexx?
In general, this is beyond regular expressions: a grammar allowing an arbitrary depth of nested parentheses is not Chomsky Type 3; not recognizable by a finite state machine. Finite state machines can't count. IIRC, SNOBOL4 has a BAL predicate for this. It can probably handle parentheses nested to any reasonable depth. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN