Introduction In many, many places throughout the code base, there is a need to parse strings. Quite often the parsing is most painlessly accomplished with regular expressions. The Perl scripting language o*ers a particularly powerful regular expression capability, and the Perl regular ex- pression syntax is popular and well known among software developers. The Perl Compatible Regular Expressions (PCRE) library library, is an open-source C library, widely available and supported on many di*erent operating systems, that implements regular expressions using the Perl regular expression syntax. Unfortunately, as a straight C library, it is a bit awkward to work with. This document describes the RE c utility class, which functions as a C++ wrapper around the PCRE C library and smooths out some of the interface kinks the bare PCRE library has.1 The RE c class is dened in re.h and implemented in re.cpp. To work, it requires that the PCRE C library be installed and available on the system. On Ubuntu Linux systems, this amounts to installing the libpcre3-dev package. The syntax for constructing Perl-type regular expressions is arcane, and regular expression strings can be di*cult to decipher even for experienced users. While the construction of Perl type regular expressions is beyond the scope of this document, readers are referred to the Perl documentation website at http://perldoc.perl.org/perlre.html for further information. Information on the underlying PCRE C library can be found at http://www.pcre.org.
Revised: September 30, 2014 |
Published: July 1, 2010
Citation
Hubbard C.W. 2010.The RE_c Utility Class Richland, WA: Pacific Northwest National Laboratory.