Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : regcomp

intregcomp(regex_t * preg,const char * pattern,int cflags) ;

Return Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of regcomp function .

1st Parameter Type : regex_t *

A pointer to a `regex_t` structure used for storing a compiled regular expression. This structure is required by POSIX regex functions like `regcomp`, `regexec`, and `regfree`.

1st Parameter

Pointer to a `regex_t` structure where the compiled regular expression will be stored.

2nd Parameter Type : const char *

Pointer to read-only string

2nd Parameter

A null-terminated string containing the regular expression pattern to be compiled.

3rd Parameter Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)

3rd Parameter

Flags that modify the behavior of the compilation, such as `REG_EXTENDED`, `REG_ICASE`, or `REG_NOSUB`.

Read more about parameters of regcomp in parameters section
The regcompfunction in C language Compiles a regular expression into a form that can be used for pattern matching.
The regcomp function compiles the regular expression contained in the string pointed to by pattern and places the results in the structure pointed to by preg. This compiled form can then be used with regexec() for string pattern matching.
The regcompfunction takes 3 parameters:
  • regex_t * `preg`: Pointer to a `regex_t` structure where the compiled regular expression will be stored.
  • const char * `pattern`: A null-terminated string containing the regular expression pattern to be compiled.
  • int `cflags`: Flags that modify the behavior of the compilation, such as `REG_EXTENDED`, `REG_ICASE`, or `REG_NOSUB`.
Compiles the regular expression specified by `pattern` into a format usable by the POSIX regex functions, storing the result in the `regex_t` structure pointed to by `preg`. The behavior of the compilation is controlled by the `cflags`. Returns `0` on success, or a nonzero error code if compilation fails.
The regcomp function return value :
  • Returns 0 for a successful compilation
  • Non-zero error codes are returned for various errors, which can be interpreted using regerror()

Output

This example demonstrates basic usage of regcomp(). It compiles a regular expression that matches strings starting with 'a' followed by alphanumeric characters, then tests it against the string 'abcdef'.