rendered paste body#include "trex.h"
#include <stdio.h>
#include <string.h>
#ifdef _UNICODE
#define trex_sprintf swprintf
#else
#define trex_sprintf sprintf
#endif
int main(int argc, char* argv[])
{
if(argc < 2) {
printf("Usage: regex [regex] string");
return 1;
}
const TRexChar *begin,*end;
TRexChar sTemp[1024];
const TRexChar *error = NULL;
TRex *x = trex_compile(_TREXC(argv[1]),&error);
if(x) {
trex_sprintf(sTemp,_TREXC(argv[2]));
if(trex_search(x,sTemp,&begin,&end)) {
trex_printf(_TREXC("matches!\n"));
}
else {
trex_printf(_TREXC("no match!\n"));
}
trex_free(x);
}
return 0;
}