From 17c92cf5b2b0dfdfdbbdb5c41354634ca98ae1b4 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 7 Jan 2010 00:24:08 +0000 Subject: Added a new class, RegEx, it does extended regular expressions for now, more to come. --- src/tests/regex.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/tests/regex.cpp (limited to 'src/tests/regex.cpp') diff --git a/src/tests/regex.cpp b/src/tests/regex.cpp new file mode 100644 index 0000000..eb3aff6 --- /dev/null +++ b/src/tests/regex.cpp @@ -0,0 +1,31 @@ +#include +#include + +int main( int argc, char *argv[] ) +{ + if( argc < 3 ) + { + printf("No... %s \n\n", argv[0] ); + return 0; + } + + Bu::RegEx re( argv[1] ); + + printf("Regex: %s\n", argv[1] ); + printf("Match: %s\n", argv[2] ); + + if( re.execute( argv[2] ) ) + { + for( int j = 0; j < re.getNumSubStrings(); j++ ) + { + printf("SubStr %d: %s\n", j, re.getSubString( j ).getStr() ); + } + } + else + { + printf("Regex did not match.\n"); + } + + return 0; +} + -- cgit v1.2.3