area51/Scratch/CJ/pcreTest/pcreTest.cpp
Andrew Sampson 431f72b93a source
2021-08-27 19:22:41 -07:00

23 lines
425 B
C++

#include "x_files.hpp"
#include "Auxiliary/PCRE/regex.hpp"
void main( int argc, char** argv )
{
if( argc < 3 )
{
x_printf( "Error" );
exit( 0 );
}
regex re( argv[1] );
re.Match( argv[2] );
int n = re.GetNumSubstrings();
x_printf( "Num = %d\n", n );
for( int i=0 ; i<n ; i++ )
{
x_printf( "Str = %.*s\n", re.GetSubstringLen(i), re.GetSubstringPtr(i) );
}
}