[mdlug] Regular Expression Library?

Robert Meier eaglecoach at wwnet.com
Wed Mar 28 22:50:44 EDT 2007


Greg,

> I am in the middle of writing a program in C which will require some regular
> expression parsing.  ...  Has anyone had any experience using any of them?

I usually use

   "regcomp, regerror, regexec, regfree - regular expression matching

   ...

    #include <regex.h>

    int regcomp(regex_t *restrict preg, const char *restrict pattern,
           int cflags);
    size_t regerror(int errcode, const regex_t *restrict preg,
           char *restrict errbuf, size_t errbuf_size);
    int regexec(const regex_t *restrict preg, const char *restrict string,
           size_t nmatch, regmatch_t pmatch[restrict], int eflags);
    void regfree(regex_t *preg);
    ..."
	 -- POSIX.2 (IEEE Std 1003.1)
	    [System Interfaces: System Interfaces: regexec]

These are included in /usr/lib/libc.a in package glibc-devel .



> ...  I am writing this program in C/C++ to accomplish what I am trying
> to do and also as a learning experience.

<SUGGESTION>
As a learning experience, may I suggest implementing a parser for
Uniform Resource Identifiers, as described by the ABNF in RFC 3986 .
</SUGGESTION>

Hopefully helpful,
-- 
Dr. Robert J. Meier



More information about the mdlug mailing list