BOOL CheckNumValid(CString strIn) { wstring szName = strIn.GetBuffer(); strIn.ReleaseBuffer(); std::wregex reg(L"^(([1-9]+\d*)|(0{1}))(.\d{1,2})?"); std::wsmatch result; BOOL bIsValid = regex_match(szName, result, reg); if (!bIsValid) { msgbox(L"请输入数字!"); } return bIsValid; }
标签:std,--,strIn,bIsValid,szName,正则表达式,正负,result,reg From: https://www.cnblogs.com/XiHua/p/17332974.html