So having such code that filters letters, and / ".:= how to allow -?
#include <boost/regex.hpp>
#include <boost/algorithm/string/regex.hpp>
std::string filter_args(std::string args)
{
std::cout << boost::erase_all_regex_copy(args, boost::regex("[^a-zA-Z0-9=\"/.: ]+"));
return boost::erase_all_regex_copy(args, boost::regex("[^a-zA-Z0-9=\"/.: ]+"));
}
Boost’s default Regex behaviour is Perl-compatible, and man perlre says:
So:
or
(notice the double-backslash; one to escape for the string literal, and the second to escape for the regex).
I recommend the former.
Always check out the documentation as your first port of call!