In that code, the string to be searched and the regex pattern are each
defined to be 50 characters long. I tried making them bigger, and
once I got past 256, regexec couldn't find the match anymore, even
though regcomp apparently compiled the pattern successfully.
I've tested a program using the Regular Expression API and have not had
any issue searching a string over 44,992 characters long, using a
regular expression 1148 characters long.
The program successfully return a match even when the match was at
position 43021 of the string.
The Code I'm using has the Data structures are defined so they are a
specific size, but that is the only difference in the definitions:
* Important Note: This DS Should be 656 bytes long. Adding
"DIM(1)"
* makes RPG pad the end of the data structure to 656 bytes
instead of 644.
* However, the extra bytes are not preserved when using a LIKEDS
unless
* the new DS is also Dim'ed.
* Therefore I have added a size to the DS itself.
D regex_t DS 656 Qualified Align
BASED(NULL_REGEXPPR)
D re_nsub Like(size_t)
D re_comp *
D re_cflags 10I 0
D re_erroff Like(size_t)
D re_len Like(size_t)
D re_ucoll LIKE(LC_colval_t) Dim(2)
D re_lsub *
D lsub_ar Like(size_t) Dim(16)
D esub_ar Like(size_t) Dim(16)
D reserved1 *
D re_esub *
D re_specchar *
D re_phdl *
D comp_spc 1A Dim(112)
D re_map 1A Dim(256)
D re_shift Like(mbstate_t)
D re_dbcs 5I 0
* Important Note: This DS Should be 16 bytes long. Adding "DIM(1)"
* makes RPG pad the end of the data struture to 16 bytes instead
of 14.
* However, the extra bytes are not preserved when using a LIKEDS
unless
* the new DS is also Dim'ed.
* Therefore I have added a size to the DS itself.
D regmatch_t DS 16 Qualified Align
BASED(NULL_REGEXPPR)
D rm_so 10I 0
D* Offset to substring
D rm_ss Like(mbstate_t)
D* Shift State at Start of Substring
D rm_eo 10I 0
D* Offset to first char after substring
D rm_es Like(mbstate_t)
D* Shift State at end of Substring
You might check if changing the data structures fixes your issue.
We are also on 7.1
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the
author and do not necessarily represent those of the company.
As an Amazon Associate we earn from qualifying purchases.