handle NULL pointer in regExp

This commit is contained in:
Mark Olesen
2008-12-18 09:30:06 +01:00
parent 239c31f30f
commit a43b7a916e
3 changed files with 50 additions and 11 deletions

View File

@ -1,3 +0,0 @@
EXE_LIBS = \
$(FOAM_LIBBIN)/libOSspecific.o

View File

@ -76,6 +76,36 @@ int main(int argc, char *argv[])
Info << endl;
}
Info<<"test regExp(const char*) ..." << endl;
string me("Mark");
if (regExp("[Mm]ar[ck]").match(me))
{
Info<< "matched: " << me << endl;
}
else
{
Info<< "no match" << endl;
}
if (regExp("").match(me))
{
Info<< "matched: " << me << endl;
}
else
{
Info<< "no match" << endl;
}
if (regExp(NULL).match(me))
{
Info<< "matched: " << me << endl;
}
else
{
Info<< "no match" << endl;
}
Info<< endl;
return 0;