c++ - how to escape a whole sequence of characters? -
i'm using following code "execute" regular expression in mfc c++
std::wregex rx(regularexpression,nflags); std::wcmatch res; std::regex_search(inputstring, res, rx); this used in dialog user types in regularexpression , search in inputstring.
the user might want not use regular expression find wants, in case provide option "whole word" match character in regularexpression variable.
the "whole word" done adding enclosing regularexpression in < , >, there other special character make regex_search method ignore every regex special character, treating them literally, enclosed < , >?
so how can escape whole string without having escape every single special character?
c++ regex not support way this. have escape each special character if you're going pass user's string regex matcher.
in regex engines there multiple modes, 1 mode treats special characters specially default , escaping them causes them behave literally, , mode characters behave literally default , have escaped in order behave specially. c++ regex doesn't support that.
Comments
Post a Comment