I am trying to store a regular expression within a variable, i.e if we had a regular expression, \\d
and a string, std::string str;
then I would store the regular expression \\d
within std::string str
. From that I could then use str
whenever I wanted to use that regular expression.
I tried something like this:
Boost::regex const string_matcher("\\d");
std::string str = string_matcher;
However I realized that it would not work. Does anyone have any ides of how I can store a regular expression?