문제

I am doing the following

std::string myregex = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"

 boost::regex re;
      re.assign(regex_expr, boost::regex_constants::icase); //Problem - Breaks

Any suggestions on what might be wrong with the assign statement

도움이 되었습니까?

해결책

The parser of some regex engines is more nitpicky than the others. However, they generally parse the regex correctly if you put - at the end of a character class.

"^[_A-Za-z0-9+-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"
             ^^
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top