#include<regex.h>
void main()
{
Sci_TextRange nTR;
regex_t reg;
const char *constPattern = "^[a-zA-Z][a-zA-Z0-9_]*\.[a-zA-Z][a-zA-Z0-9_]*$";
if (0 > regcomp(®, constPattern, REG_EXTENDED)) // 编译正则
{
return FALSE;
}
if (0 != regexec(®, szFullName, 0, NULL, 0)) // 模式匹配
{
return FALSE;
}
regfree(®); // 释放正则
}
参考:https://blog.csdn.net/suxuecyuyan/article/details/87900998