Daniel Frey wrote: > Edward Diener wrote: >> You can turn on the literal flag type. All characters in your regular >> expression are treated as literals. > > That doesn't help. Maybe an example clarifies what I need: > > std::string s = "1.30.0"; > boost::regex r( "^(.*)\s+(?:[Vv](?:ersion)?\s+" + s + ")\s*$" ); > > I need a way to convert 's' to '1\.30\.0', not to escape the whole > regex.
No such function exist in the regex++ library but it should be easy enough to build one for yourself. In the regex++ doc, under the syntax topic there is a list of all the characters that aren't literals. Put them in a static string and write a transformation function which checks each character in your source string and if it matches one in the static string, added a backslash in front of it before putting it in a result string. BTW, in your example above, you of course need two backslashes for every backslash that occurs in your string literal. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost