This *is* the error returned by the underlying C library.  For example:

#include <stdio.h>
#include <sys/types.h>
#include <regex.h>

int main() {
  char buf[128] = {0};
  regex_t rx = {0};
  int status = regcomp(&rx, "[a-Z]", REG_EXTENDED);
  size_t ret = regerror(status, &rx, buf, sizeof buf);
  printf("status: %d, ret: %d, buf: [%s]\n", status, ret, buf);
  return 0;
}


gcc -o rx rx.c && ./rx
status: 11, ret: 18, buf: [Invalid range end]

--Dale