Search code examples
c++boost-regexignore-case

Ignore case using boost::regex_search


How do you use boost::regex_search with the ignore case flags or constants in C++?

Please post an easy example.

Thanks!


Solution

  • You need something like this

    boost::regex regex("your expression here", boost::regex::icase);
    boost::smatch what;
    
    string mystring;
    bool search_result = boost::regex_search(mystring.begin(),mystring.end(), what, regex);