28 #include <Exception/Exception.h> 30 #include "colselect.h" 51 const std::string& str,
52 const std::string& pattern
56 pcre_extra* pe = NULL;
64 if ( NULL == (re = pcre_compile( pattern.c_str( ),
69 throw( Exception( error ) );
71 if ( 0 > (rc = pcre_exec( re,
81 case PCRE_ERROR_NOMATCH:
85 throw( Exception(
"NULL pattern or subject string." ) );
87 case PCRE_ERROR_BADOPTION:
88 throw( Exception(
"Bad option." ) );
90 case PCRE_ERROR_BADMAGIC:
91 throw( Exception(
"Bad magic number(possible junk regex pointer?)" ) );
93 case PCRE_ERROR_UNKNOWN_NODE:
94 throw( Exception(
"Was your compiled pattern overwritten?" ) );
96 case PCRE_ERROR_NOMEMORY:
97 throw( Exception(
"Out of memory." ) );
100 throw( Exception(
"Unforeseen matching error." ) ) ;
The suplib namespace encompasses all of the functions in the suplib++ library.
bool match(const std::string &str, const std::string &pattern)
handles Perl regular expression matching.