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…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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:

  1. include <sys/types.h>
  2. 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]