Regex: ignore case sensitivity

后端 未结 13 1817
孤城傲影
孤城傲影 2020-11-22 06:11

How can I make the following regex ignore case sensitivity? It should match all the correct characters but ignore whether they are lower or uppercase.

G[a-b]         


        
13条回答
  •  旧巷少年郎
    2020-11-22 06:45

    Just for the sake of completeness I wanted to add the solution for regular expressions in C++ with Unicode:

    std::tr1::wregex pattern(szPattern, std::tr1::regex_constants::icase);
    
    if (std::tr1::regex_match(szString, pattern))
    {
    ...
    }
    

提交回复
热议问题