Scroll Down to See All▾
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1ynFunction Details : regerror
size_tregerror(int errcode,const regex_t * preg,char * errbuf,size_t errbuf_size) ;
Return Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
Read about return values of regerror function .
1st Parameter Type : int
Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
1st Parameter
The error code returned by a previous regex function (e.g., `regcomp` or `regexec`).
2nd Parameter Type : const regex_t *
A pointer to a constant `regex_t` structure representing a compiled regular expression. The `const` qualifier ensures the structure cannot be modified through this pointer.
2nd Parameter
Pointer to the `regex_t` structure associated with the regex operation that produced the error.
3rd Parameter Type : char *
String pointer (array of characters)
3rd Parameter
Pointer to a buffer where the error message will be stored. Can be `NULL` to determine the required buffer size.
4th Parameter Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
4th Parameter
The size of the buffer pointed to by `errbuf`.
Read more about parameters of regerror in parameters section
The regerrorfunction in C language Produces a human-readable error message based on the error code from regcomp or regexec.
The regerror function is used to generate a human-readable string describing the error code returned by regcomp or regexec. It's an essential part of error handling in regular expression operations.
The regerrorfunction takes 4
parameters:Retrieves a human-readable error message corresponding to the `errcode` returned by a regex function. The error message is stored in the `errbuf` buffer, truncated if necessary to fit within `errbuf_size`. If `errbuf` is `NULL`, the function returns the size of the buffer required to hold the entire message. Returns the length of the error message, excluding the null terminator.
- •int `errcode`: The error code returned by a previous regex function (e.g., `regcomp` or `regexec`).
- •const regex_t * `preg`: Pointer to the `regex_t` structure associated with the regex operation that produced the error.
- •char * `errbuf`: Pointer to a buffer where the error message will be stored. Can be `NULL` to determine the required buffer size.
- •size_t `errbuf_size`: The size of the buffer pointed to by `errbuf`.
The regerror function return value :
- Returns the size of the error message string, including the null terminator
Output
This example demonstrates how to use regerror to get a human-readable error message when regex compilation fails.