X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Ftests%2Fbiblio.cpp;h=067cc9b4481b5bd6ae14385b3d1ba5a2e8a00a39;hb=273c67d8aa34a724ca03e01ae8e1792949c23297;hp=5a7a376d3e40a33086b9eb07cee86a7cb456eff2;hpb=dbce5cafcc16706a9d6b7e283daf3ac5bee487fb;p=lyx.git diff --git a/src/frontends/tests/biblio.cpp b/src/frontends/tests/biblio.cpp index 5a7a376d3e..067cc9b448 100644 --- a/src/frontends/tests/biblio.cpp +++ b/src/frontends/tests/biblio.cpp @@ -20,10 +20,17 @@ string const escape_special_chars(string const & expr) // $& is a ECMAScript format expression that expands to all // of the current match - // The '$' must be prefixed with the escape character '\' for - // boost to treat it as a literal. - // Thus, to prefix a matched expression with '\', we use: +#ifdef LYX_USE_STD_REGEX + // To prefix a matched expression with a single literal backslash, we + // need to escape it for the C++ compiler and use: + return lyx::regex_replace(expr, reg, "\\$&"); +#else + // A backslash in the format string starts an escape sequence in boost. + // Thus, to prefix a matched expression with a single literal backslash, + // we need to give two backslashes to the regex engine, and escape both + // for the C++ compiler and use: return lyx::regex_replace(expr, reg, "\\\\$&"); +#endif }