以备忘!
#include<regex.h>
boolTools::isRegularExpressMatch(constchar* p_strPattern,constchar* p_strThatBeChecked){
intl_iStatus;
intl_cflags =REG_EXTENDED;
regmatch_tpmatch[1];
constsize_tnmatch =1;
regex_treg;
regcomp(®,p_strPattern,l_cflags);
l_iStatus =regexec(®,p_strThatBeChecked,nmatch,pmatch,0);
regfree(®);
if(l_iStatus ==REG_NOMATCH){
returnfalse;
}else{
returntrue;
}
}
原文链接:https://www.f2er.com/regex/362855.html