On Thu, Apr 20, 2023 at 09:30:06PM +0200, наб wrote: > If REG_STARTEND, pmatch must point to a valid readable object. > (Naturally, if you pass in uninitialised memory or a null pointer, > then you get UB.) > nmatch is not consulted and has no bearing on this. This is all to say: regexec(®, "str", 0, &rm, REG_STARTEND); is valid, looks in ["str"+rm.so, "str"+rm.eo), and doesn't change rm, whereas regexec(®, "str", 1, &rm, REG_STARTEND); is valid, looks in ["str"+rm.so, "str"+rm.eo), and will update rm with the match, if any.
Attachment:
signature.asc
Description: PGP signature