static docstring escape_special_chars(docstring const & expr)
{
// Search for all chars '.|*?+(){}[^$]\'
- // Note that '[' and '\' must be escaped.
- // This is a limitation of lyx::regex, but all other chars in BREs
- // are assumed literal.
- static const lyx::regex reg("[].|*?+(){}^$\\[\\\\]");
+ // Note that '[', ']', and '\' must be escaped.
+ static const lyx::regex reg("[.|*?+(){}^$\\[\\]\\\\]");
- // $& is a perl-like expression that expands to all
+ // $& is an 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.
string const escape_special_chars(string const & expr)
{
// Search for all chars '.|*?+(){}[^$]\'
- // Note that '[' and '\' must be escaped.
- // This is a limitation of lyx::regex, but all other chars in BREs
- // are assumed literal.
- lyx::regex reg("[].|*?+(){}^$\\[\\\\]");
+ // Note that '[', ']', and '\' must be escaped.
+ lyx::regex reg("[.|*?+(){}^$\\[\\]\\\\]");
- // $& is a perl-like expression that expands to all
+ // $& 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.
// "[,,,,foo..." -> "foo..." ("foo..." may be empty)
string output;
lyx::smatch what;
- static lyx::regex const front("^( *[[],*)(.*)$");
+ static lyx::regex const front("^( *\\[,*)(.*)$");
regex_match(it, end, what, front);
if (!what[0].matched) {
// Strip any trailing commas
// "...foo,,,]" -> "...foo" ("...foo,,," may be empty)
- static lyx::regex const back("^(.*[^,])?,*[]] *$");
+ static lyx::regex const back("^(.*[^,])?,*\\] *$");
regex_match(output, what, back);
if (!what[0].matched) {
lyxerr << "Unable to sanitize LaTeX \"Option\": "