Skip to content

Instantly share code, notes, and snippets.

@knoxxs
Created October 29, 2012 18:45
Show Gist options
  • Save knoxxs/3975635 to your computer and use it in GitHub Desktop.
Save knoxxs/3975635 to your computer and use it in GitHub Desktop.
API of regcomp
int regcomp(regex_t *preg, const char *regex, int cflags);
preg - It is a pointer to a structure regex_t.
regex - Pointer to a null terminated string which contains the pattern
cflags - bitwise-or of one or more of the following:
REG_EXTENDED
Use POSIX Extended Regular Expression syntax when interpreting regex. If not set, POSIX Basic Regular Expression syntax is used.
REG_ICASE
Do not differentiate case. Subsequent regexec() searches using this pattern buffer will be case insensitive.
REG_NOSUB
Support for substring addressing of matches is not required. The nmatch and pmatch arguments to regexec() are ignored if the pattern buffer supplied was compiled with this flag set.
REG_NEWLINE
Match-any-character operators don't match a newline.
A nonmatching list ([^...]) not containing a newline does not match a newline.
Match-beginning-of-line operator (^) matches the empty string immediately after a newline, regardless of whether eflags, the execution flags of regexec(), contains REG_NOTBOL.
Match-end-of-line operator ($) matches the empty string immediately before a newline, regardless of whether eflags contains REG_NOTEOL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment