正则表达式

#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(&reg, constPattern, REG_EXTENDED)) //  编译正则
  {
    return FALSE;
  }
  if (0 != regexec(&reg, szFullName, 0, NULL, 0)) //  模式匹配
  {
    return FALSE;
  }
  regfree(&reg); //  释放正则

}

参考:https://blog.csdn.net/suxuecyuyan/article/details/87900998

posted @ 2019-07-01 22:38  熊云港  阅读(156)  评论(0编辑  收藏  举报