Write c++ regular expression to match a #include preprocessing directive
问题 I want to write a regular expression in c++ to match a #include preprocessing directive. So I wrote this: std::regex includePattern("^[[:blank:]|[:space:]]*#[[:blank:]|[:space:]]*include[[:blank:]|[:space:]]+[<|\"]{1}[_[:alpha:]]+[_[:alnum:]]*"); This is worked for: std::string matchString = "#include <vector>"; But only matches parts of the string excluded the trailing ">", but if I change the regex to this: std::regex includePattern("^[[:blank:]|[:space:]]*#[[:blank:]|[:space:]]*include[[