Tip 15: GCC Regex Library
From Vlsiwiki
Revision as of 00:49, 9 March 2011 by Test (Talk | contribs) (Created page with 'The C Regex library is standard with GCC and uses POSIX style regular expressions. This is opposed to Perl style regular expressions which are more common among scripting languag…')
The C Regex library is standard with GCC and uses POSIX style regular expressions. This is opposed to Perl style regular expressions which are more common among scripting languages.
To include regex in C (or C++) you must include:
- include <sys/types.h>
- include <regex.h>
There are 4 available command:
int regcomp(regex_t *, const char *, int); int regexec(const regex_t *, const char *, size_t, regmatch_t[], int); size_t regerror(int, const regex_t *, char *, size_t); void regfree(regex_t *);
Beyond that, read the man page [1]