René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Perl Compatible Regular Expressions (PCRE) on Windows

PCRE is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. The PCRE library is free, even for building commercial software.

Compiling for a Windows platform

I found it a bit difficult to compile PCRE on Windows (at least with MinGW). So, I decided to describe the necessary steps in case I or someone else needs the library in a Windows program.
Download it.
Rename pcre.in to pcre.h
Rename config.in to config.h
In config.h change:
#define HAVE_STRERROR 1
#define HAVE_MEMMOVE  1
Compile dftables.c
gcc dftables.c
This produces the executable a.exe.
Run a.exe as follows:
a.exe chartables.c
This produces a c file: chartables.c.
gcc pcre.c chartables.c get.c pcregrep.c pcreposix.c study.c
gcc -I. pcre.c chartables.c get.c pcredemo.c pcreposix.c  study.c
gcc -I. pcre.c get.c pcretest.c pcreposix.c  study.c maketables.c

Demo programs

C++ wrapper

I have written a C++ wrapper for PCRE.