From 51e21a316be6e052251b3dfc7d671061ebd67cee Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 21 Dec 2009 18:03:28 +0000 Subject: Removed the old trunk contents. About to load up m3 --- regexptest.cpp | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 regexptest.cpp (limited to 'regexptest.cpp') diff --git a/regexptest.cpp b/regexptest.cpp deleted file mode 100644 index 01597be..0000000 --- a/regexptest.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include - -int test( const char *str, const char *sRegExp ) -{ - printf("Compiling: %s\n", sRegExp ); - regex_t r; - if( regcomp( &r, sRegExp, REG_EXTENDED|REG_NEWLINE ) ) - { - printf("Error compiling regular expression.\n"); - return 0; - } - - printf("Compiled, %d sub expressions.\n", r.re_nsub ); - - int nMatch = r.re_nsub+1; - regmatch_t *match = new regmatch_t[nMatch]; - if( regexec( &r, str, nMatch, match, 0 ) ) - { - printf("Regular expression did not match.\n"); - return 0; - } - - printf("Match!\nSubstrings:\n"); - for( int j = 0; j < nMatch; j++ ) - { - printf(" %d: (%d-%d) %s\n", - j, - match[j].rm_so, match[j].rm_eo, - std::string(str+match[j].rm_so, match[j].rm_eo-match[j].rm_so ).c_str() - ); - } - - delete[] match; - regfree( &r ); -} - -int main( int argc, char *argv[] ) -{ - printf("Regular expression test:\n\n"); - - test( argv[1], argv[2] ); - - return 0; -} - -- cgit v1.2.3