Can be demonstrated with the following test program. This works fine with
regcomp() on linux and other RE platforms (PCRE, javascript, python, etc).
/* test regcomp with more than 9 (groups).
On z/OS V2R3, fails with:
Invalid regular expression '...' - (rc=8) \( \) or ( ) imbalance
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
int main(int argc, char** argv) {
int failed = 0;
char buf[100];
regex_t rx;
const char* testRE =
"(^a1$)|(^a2$)|(^a3$)|(^a4$)|(^a5$)|(^a6$)|(^a7$)|(^a8$)|(^a9$)|(^a10$)";
int rc = regcomp(&rx, testRE, REG_EXTENDED | REG_NOSUB);
if (rc) {
regerror(rc, &rx, buf, sizeof(buf));
fprintf(stderr, "Invalid regular expression '%s' - (rc=%d) %s\n",
testRE, rc, buf);
failed = 1;
}
return failed;
}
Switching to BREs, doesn't help. Something probably didn't fit in 80 bytes
:-)
Really sucks.
Kirk Wolf
Dovetailed Technologies
http://dovetail.com
PS> I can find no documented limit of "9" groups here:
https://pubs.opengroup.org/onlinepubs/007904875/basedefs/xbd_chap09.html
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN