Include standard <regex>

This commit is contained in:
Yuriy Skalko 2020-11-29 01:05:24 +02:00
parent 54ccd275f1
commit 7779316e6c
20 changed files with 70 additions and 120 deletions

View File

@ -32,10 +32,10 @@
#include "support/gettext.h" #include "support/gettext.h"
#include "support/lassert.h" #include "support/lassert.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/regex.h"
#include "support/textutils.h" #include "support/textutils.h"
#include <map> #include <map>
#include <regex>
#include <set> #include <set>
using namespace std; using namespace std;
@ -383,8 +383,8 @@ docstring convertLaTeXCommands(docstring const & str)
// {\v a} to \v{a} (see #9340). // {\v a} to \v{a} (see #9340).
// FIXME: This is a sort of mini-tex2lyx. // FIXME: This is a sort of mini-tex2lyx.
// Use the real tex2lyx instead! // Use the real tex2lyx instead!
static lyx::regex const tma_reg("^\\{\\\\[bcCdfGhHkrtuUv]\\s\\w\\}"); static regex const tma_reg("^\\{\\\\[bcCdfGhHkrtuUv]\\s\\w\\}");
if (lyx::regex_search(to_utf8(val), tma_reg)) { if (regex_search(to_utf8(val), tma_reg)) {
val = val.substr(1); val = val.substr(1);
val.replace(2, 1, from_ascii("{")); val.replace(2, 1, from_ascii("{"));
continue; continue;
@ -411,8 +411,8 @@ docstring convertLaTeXCommands(docstring const & str)
// look for that and change it, if necessary. // look for that and change it, if necessary.
// FIXME: This is a sort of mini-tex2lyx. // FIXME: This is a sort of mini-tex2lyx.
// Use the real tex2lyx instead! // Use the real tex2lyx instead!
static lyx::regex const reg("^\\\\\\W\\w"); static regex const reg("^\\\\\\W\\w");
if (lyx::regex_search(to_utf8(val), reg)) { if (regex_search(to_utf8(val), reg)) {
val.insert(3, from_ascii("}")); val.insert(3, from_ascii("}"));
val.insert(2, from_ascii("{")); val.insert(2, from_ascii("{"));
} }

View File

@ -36,9 +36,8 @@
#include "support/Systemcall.h" #include "support/Systemcall.h"
#include "support/os.h" #include "support/os.h"
#include "support/regex.h"
#include <fstream> #include <fstream>
#include <regex>
#include <stack> #include <stack>

View File

@ -40,9 +40,9 @@
#include "support/docstring.h" #include "support/docstring.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/regex.h"
#include <algorithm> #include <algorithm>
#include <regex>
using namespace std; using namespace std;

View File

@ -19,11 +19,10 @@
#include "support/FileName.h" #include "support/FileName.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lassert.h" #include "support/lassert.h"
#include "support/regex.h"
#include "support/TempFile.h" #include "support/TempFile.h"
#include <fstream> #include <fstream>
#include <regex>
using namespace std; using namespace std;
using namespace lyx::support; using namespace lyx::support;

View File

@ -72,13 +72,13 @@
#include "support/lassert.h" #include "support/lassert.h"
#include "support/limited_stack.h" #include "support/limited_stack.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/regex.h"
#include "mathed/InsetMathHull.h" #include "mathed/InsetMathHull.h"
#include "mathed/InsetMathMacroTemplate.h" #include "mathed/InsetMathMacroTemplate.h"
#include "lyxfind.h" #include "lyxfind.h"
#include <clocale> #include <clocale>
#include <regex>
#include <sstream> #include <sstream>
using namespace std; using namespace std;

View File

@ -26,11 +26,11 @@
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/PathChanger.h" #include "support/PathChanger.h"
#include "support/Systemcall.h" #include "support/Systemcall.h"
#include "support/regex.h"
#include "support/TempFile.h" #include "support/TempFile.h"
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <regex>
#include <sstream> #include <sstream>
using namespace std; using namespace std;

View File

@ -45,9 +45,8 @@
#undef KeyPress #undef KeyPress
#include "support/regex.h"
#include <algorithm> #include <algorithm>
#include <regex>
#include <string> #include <string>
#include <vector> #include <vector>
@ -987,21 +986,21 @@ static docstring escape_special_chars(docstring const & expr)
{ {
// Search for all chars '.|*?+(){}[^$]\' // Search for all chars '.|*?+(){}[^$]\'
// Note that '[', ']', and '\' must be escaped. // Note that '[', ']', and '\' must be escaped.
static const lyx::regex reg("[.|*?+(){}^$\\[\\]\\\\]"); static const regex reg("[.|*?+(){}^$\\[\\]\\\\]");
// $& is an ECMAScript format expression that expands to all // $& is an ECMAScript format expression that expands to all
// of the current match // of the current match
// To prefix a matched expression with a single literal backslash, we // To prefix a matched expression with a single literal backslash, we
// need to escape it for the C++ compiler and use: // need to escape it for the C++ compiler and use:
// FIXME: UNICODE // FIXME: UNICODE
return from_utf8(lyx::regex_replace(to_utf8(expr), reg, string("\\$&"))); return from_utf8(regex_replace(to_utf8(expr), reg, string("\\$&")));
} }
vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi, vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
vector<docstring> const & keys_to_search, bool only_keys, vector<docstring> const & keys_to_search, bool only_keys,
docstring const & search_expression, docstring const & field, docstring const & search_expression, docstring const & field,
bool case_sensitive, bool regex) bool case_sensitive, bool re)
{ {
vector<docstring> foundKeys; vector<docstring> foundKeys;
@ -1009,17 +1008,17 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
if (expr.empty()) if (expr.empty())
return foundKeys; return foundKeys;
if (!regex) if (!re)
// We must escape special chars in the search_expr so that // We must escape special chars in the search_expr so that
// it is treated as a simple string by lyx::regex. // it is treated as a simple string by regex.
expr = escape_special_chars(expr); expr = escape_special_chars(expr);
lyx::regex reg_exp; regex reg_exp;
try { try {
reg_exp.assign(to_utf8(expr), case_sensitive ? reg_exp.assign(to_utf8(expr), case_sensitive ?
lyx::regex_constants::ECMAScript : lyx::regex_constants::icase); regex_constants::ECMAScript : regex_constants::icase);
} catch (lyx::regex_error const & e) { } catch (regex_error const & e) {
// lyx::regex throws an exception if the regular expression is not // regex throws an exception if the regular expression is not
// valid. // valid.
LYXERR(Debug::GUI, e.what()); LYXERR(Debug::GUI, e.what());
return vector<docstring>(); return vector<docstring>();
@ -1045,10 +1044,10 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
continue; continue;
try { try {
if (lyx::regex_search(sdata, reg_exp)) if (regex_search(sdata, reg_exp))
foundKeys.push_back(*it); foundKeys.push_back(*it);
} }
catch (lyx::regex_error const & e) { catch (regex_error const & e) {
LYXERR(Debug::GUI, e.what()); LYXERR(Debug::GUI, e.what());
return vector<docstring>(); return vector<docstring>();
} }

View File

@ -58,8 +58,7 @@
// for FileFilter. // for FileFilter.
// FIXME: Remove // FIXME: Remove
#include "support/regex.h" #include <regex>
using namespace std; using namespace std;
using namespace lyx::support; using namespace lyx::support;
@ -496,10 +495,10 @@ static string const convert_brace_glob(string const & glob)
{ {
// Matches " *.{abc,def,ghi}", storing "*." as group 1 and // Matches " *.{abc,def,ghi}", storing "*." as group 1 and
// "abc,def,ghi" as group 2, while allowing spaces in group 2. // "abc,def,ghi" as group 2, while allowing spaces in group 2.
static lyx::regex const glob_re(" *([^ {]*)\\{([^}]+)\\}"); static regex const glob_re(" *([^ {]*)\\{([^}]+)\\}");
// Matches "abc" and "abc,", storing "abc" as group 1, // Matches "abc" and "abc,", storing "abc" as group 1,
// while ignoring surrounding spaces. // while ignoring surrounding spaces.
static lyx::regex const block_re(" *([^ ,}]+) *,? *"); static regex const block_re(" *([^ ,}]+) *,? *");
string pattern; string pattern;
@ -624,14 +623,14 @@ FileFilterList::FileFilterList(docstring const & qt_style_filter)
// Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)" // Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)"
// into individual filters. // into individual filters.
static lyx::regex const separator_re(";;"); static regex const separator_re(";;");
string::const_iterator it = filter.begin(); string::const_iterator it = filter.begin();
string::const_iterator const end = filter.end(); string::const_iterator const end = filter.end();
while (true) { while (true) {
match_results<string::const_iterator> what; match_results<string::const_iterator> what;
if (!lyx::regex_search(it, end, what, separator_re)) { if (!regex_search(it, end, what, separator_re)) {
parse_filter(string(it, end)); parse_filter(string(it, end));
break; break;
} }
@ -650,10 +649,10 @@ void FileFilterList::parse_filter(string const & filter)
{ {
// Matches "TeX documents (plain) (*.tex)", // Matches "TeX documents (plain) (*.tex)",
// storing "TeX documents (plain) " as group 1 and "*.tex" as group 2. // storing "TeX documents (plain) " as group 1 and "*.tex" as group 2.
static lyx::regex const filter_re("(.*)\\(([^()]+)\\) *$"); static regex const filter_re("(.*)\\(([^()]+)\\) *$");
match_results<string::const_iterator> what; match_results<string::const_iterator> what;
if (!lyx::regex_search(filter, what, filter_re)) { if (!regex_search(filter, what, filter_re)) {
// Just a glob, no description. // Just a glob, no description.
filters_.push_back(Filter(docstring(), trim(filter))); filters_.push_back(Filter(docstring(), trim(filter)));
} else { } else {

View File

@ -2,8 +2,7 @@
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <regex>
#include "support/regex.h"
using namespace std; using namespace std;
@ -16,13 +15,13 @@ string const escape_special_chars(string const & expr)
{ {
// Search for all chars '.|*?+(){}[^$]\' // Search for all chars '.|*?+(){}[^$]\'
// Note that '[', ']', and '\' must be escaped. // Note that '[', ']', and '\' must be escaped.
lyx::regex reg("[.|*?+(){}^$\\[\\]\\\\]"); regex reg("[.|*?+(){}^$\\[\\]\\\\]");
// $& is a ECMAScript format expression that expands to all // $& is a ECMAScript format expression that expands to all
// of the current match // of the current match
// To prefix a matched expression with a single literal backslash, we // To prefix a matched expression with a single literal backslash, we
// need to escape it for the C++ compiler and use: // need to escape it for the C++ compiler and use:
return lyx::regex_replace(expr, reg, "\\$&"); return regex_replace(expr, reg, "\\$&");
} }
@ -49,11 +48,11 @@ public:
// Attempts to find a match for the current RE // Attempts to find a match for the current RE
// somewhere in data. // somewhere in data.
return lyx::regex_search(data, regex_); return regex_search(data, regex_);
} }
private: private:
InfoMap const map_; InfoMap const map_;
mutable lyx::regex regex_; mutable regex regex_;
}; };
@ -77,7 +76,7 @@ void test_RegexMatch()
cout << rm("hello") << endl; cout << rm("hello") << endl;
cout << rm("hei") << endl; cout << rm("hei") << endl;
} }
catch (lyx::regex_error & regerr) { catch (regex_error & regerr) {
cout << regerr.what() << endl; cout << regerr.what() << endl;
} }
} }

View File

@ -29,7 +29,8 @@
#include "support/docstream.h" #include "support/docstream.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/FileName.h" #include "support/FileName.h"
#include "support/regex.h"
#include <regex>
using namespace std; using namespace std;
using namespace lyx::support; using namespace lyx::support;
@ -58,13 +59,13 @@ string const readBB_from_PSFile(FileName const & file)
return string(); return string();
} }
static lyx::regex bbox_re("^%%BoundingBox:\\s*([-]*[[:digit:]]+)" static regex bbox_re("^%%BoundingBox:\\s*([-]*[[:digit:]]+)"
"\\s+([-]*[[:digit:]]+)\\s+([-]*[[:digit:]]+)\\s+([-]*[[:digit:]]+)"); "\\s+([-]*[[:digit:]]+)\\s+([-]*[[:digit:]]+)\\s+([-]*[[:digit:]]+)");
ifstream is(file_.toFilesystemEncoding().c_str()); ifstream is(file_.toFilesystemEncoding().c_str());
while (is) { while (is) {
string s; string s;
getline(is,s); getline(is,s);
lyx::smatch what; smatch what;
if (regex_match(s, what, bbox_re)) { if (regex_match(s, what, bbox_re)) {
// Our callers expect the tokens in the string // Our callers expect the tokens in the string
// separated by single spaces. // separated by single spaces.

View File

@ -18,9 +18,8 @@
#include "support/lyxlib.h" // float_equal #include "support/lyxlib.h" // float_equal
#include "support/Translator.h" #include "support/Translator.h"
#include "support/regex.h"
#include <cmath> // abs #include <cmath> // abs
#include <regex>
#include <sstream> #include <sstream>
using namespace std; using namespace std;
@ -282,8 +281,8 @@ string const sanitizeLatexOption(string const & input)
// Strip any leading commas // Strip any leading commas
// "[,,,,foo..." -> "foo..." ("foo..." may be empty) // "[,,,,foo..." -> "foo..." ("foo..." may be empty)
string output; string output;
lyx::smatch what; smatch what;
static lyx::regex const front("^( *\\[,*)(.*)$"); static regex const front("^( *\\[,*)(.*)$");
if (!regex_match(it, end, what, front)) { if (!regex_match(it, end, what, front)) {
lyxerr << "Unable to sanitize LaTeX \"Option\": " lyxerr << "Unable to sanitize LaTeX \"Option\": "
@ -295,7 +294,7 @@ string const sanitizeLatexOption(string const & input)
// Replace any consecutive commas with a single one // Replace any consecutive commas with a single one
// "foo,,,,bar" -> "foo,bar" // "foo,,,,bar" -> "foo,bar"
// with iterator now pointing to 'b' // with iterator now pointing to 'b'
static lyx::regex const commas("([^,]*)(,,*)(.*)$"); static regex const commas("([^,]*)(,,*)(.*)$");
for (; it != end;) { for (; it != end;) {
if (!regex_match(it, end, what, commas)) { if (!regex_match(it, end, what, commas)) {
output += string(it, end); output += string(it, end);
@ -307,7 +306,7 @@ string const sanitizeLatexOption(string const & input)
// Strip any trailing commas // Strip any trailing commas
// "...foo,,,]" -> "...foo" ("...foo,,," may be empty) // "...foo,,,]" -> "...foo" ("...foo,,," may be empty)
static lyx::regex const back("^(.*[^,])?,*\\] *$"); static regex const back("^(.*[^,])?,*\\] *$");
if (!regex_match(output, what, back)) { if (!regex_match(output, what, back)) {
lyxerr << "Unable to sanitize LaTeX \"Option\": " lyxerr << "Unable to sanitize LaTeX \"Option\": "
<< output << '\n'; << output << '\n';

View File

@ -43,7 +43,6 @@
#include "support/ExceptionMessage.h" #include "support/ExceptionMessage.h"
#include "support/FileNameList.h" #include "support/FileNameList.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/regex.h"
#include "support/gettext.h" #include "support/gettext.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/os.h" #include "support/os.h"
@ -52,6 +51,7 @@
#include <limits> #include <limits>
#include <map> #include <map>
#include <regex>
#include <utility> #include <utility>
#include <iostream> #include <iostream>
@ -1188,8 +1188,8 @@ void InsetBibtex::docbook(XMLStream & xs, OutputParams const &) const
string html = to_utf8(bibinfo.getInfo(entry.key(), buffer(), ci)); string html = to_utf8(bibinfo.getInfo(entry.key(), buffer(), ci));
regex tagRegex("<span class=\"bib-([^\"]*)\">([^<]*)</span>"); regex tagRegex("<span class=\"bib-([^\"]*)\">([^<]*)</span>");
smatch match; smatch match;
auto tagIt = lyx::sregex_iterator(html.cbegin(), html.cend(), tagRegex, regex_constants::match_default); auto tagIt = sregex_iterator(html.cbegin(), html.cend(), tagRegex, regex_constants::match_default);
auto tagEnd = lyx::sregex_iterator(); auto tagEnd = sregex_iterator();
map<string, string> delayedTags; map<string, string> delayedTags;
// Read all tags from HTML and convert those that have a 1:1 matching. // Read all tags from HTML and convert those that have a 1:1 matching.

View File

@ -44,8 +44,7 @@
#include "frontends/alert.h" #include "frontends/alert.h"
#include "frontends/Application.h" #include "frontends/Application.h"
#include "support/regex.h" #include <regex>
#include <sstream> #include <sstream>
using namespace std; using namespace std;

View File

@ -46,10 +46,10 @@
#include "support/gettext.h" #include "support/gettext.h"
#include "support/lassert.h" #include "support/lassert.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/regex.h"
#include "support/textutils.h" #include "support/textutils.h"
#include <map> #include <map>
#include <regex>
using namespace std; using namespace std;
using namespace lyx::support; using namespace lyx::support;
@ -773,10 +773,10 @@ string escape_for_regex(string s, bool match_latex)
bool regex_replace(string const & s, string & t, string const & searchstr, bool regex_replace(string const & s, string & t, string const & searchstr,
string const & replacestr) string const & replacestr)
{ {
lyx::regex e(searchstr, regex_constants::ECMAScript); regex e(searchstr, regex_constants::ECMAScript);
ostringstream oss; ostringstream oss;
ostream_iterator<char, char> it(oss); ostream_iterator<char, char> it(oss);
lyx::regex_replace(it, s.begin(), s.end(), e, replacestr); regex_replace(it, s.begin(), s.end(), e, replacestr);
// tolerate t and s be references to the same variable // tolerate t and s be references to the same variable
bool rv = (s != oss.str()); bool rv = (s != oss.str());
t = oss.str(); t = oss.str();
@ -881,9 +881,9 @@ private:
// normalized string to search // normalized string to search
string par_as_string; string par_as_string;
// regular expression to use for searching // regular expression to use for searching
lyx::regex regexp; regex regexp;
// same as regexp, but prefixed with a ".*?" // same as regexp, but prefixed with a ".*?"
lyx::regex regexp2; regex regexp2;
// leading format material as string // leading format material as string
string lead_as_string; string lead_as_string;
// par_as_string after removal of lead_as_string // par_as_string after removal of lead_as_string
@ -955,11 +955,11 @@ static size_t identifyLeading(string const & s)
// @TODO Support \item[text] // @TODO Support \item[text]
// Kornel: Added textsl, textsf, textit, texttt and noun // Kornel: Added textsl, textsf, textit, texttt and noun
// + allow to search for colored text too // + allow to search for colored text too
while (regex_replace(t, t, REGEX_BOS "\\\\(((footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge|emph|noun|minisec|text(bf|md|sl|sf|it|tt))|((textcolor|foreignlanguage|latexenvironment)\\{[a-z]+\\*?\\})|(u|uu)line|(s|x)out|uwave)|((sub)?(((sub)?section)|paragraph)|part|chapter)\\*?)\\{", "") while (regex_replace(t, t, "^\\\\(((footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge|emph|noun|minisec|text(bf|md|sl|sf|it|tt))|((textcolor|foreignlanguage|latexenvironment)\\{[a-z]+\\*?\\})|(u|uu)line|(s|x)out|uwave)|((sub)?(((sub)?section)|paragraph)|part|chapter)\\*?)\\{", "")
|| regex_replace(t, t, REGEX_BOS "\\$", "") || regex_replace(t, t, "^\\$", "")
|| regex_replace(t, t, REGEX_BOS "\\\\\\[", "") || regex_replace(t, t, "^\\\\\\[", "")
|| regex_replace(t, t, REGEX_BOS " ?\\\\item\\{[a-z]+\\}", "") || regex_replace(t, t, "^ ?\\\\item\\{[a-z]+\\}", "")
|| regex_replace(t, t, REGEX_BOS "\\\\begin\\{[a-zA-Z_]*\\*?\\}", "")) || regex_replace(t, t, "^\\\\begin\\{[a-zA-Z_]*\\*?\\}", ""))
; ;
LYXERR(Debug::FIND, " after removing leading $, \\[ , \\emph{, \\textbf{, etc.: '" << t << "'"); LYXERR(Debug::FIND, " after removing leading $, \\[ , \\emph{, \\textbf{, etc.: '" << t << "'");
return s.find(t); return s.find(t);
@ -2688,13 +2688,13 @@ static int identifyClosing(string & t)
int open_braces = 0; int open_braces = 0;
do { do {
LYXERR(Debug::FIND, "identifyClosing(): t now is '" << t << "'"); LYXERR(Debug::FIND, "identifyClosing(): t now is '" << t << "'");
if (regex_replace(t, t, "(.*[^\\\\])\\$" REGEX_EOS, "$1")) if (regex_replace(t, t, "(.*[^\\\\])\\$$", "$1"))
continue; continue;
if (regex_replace(t, t, "(.*[^\\\\])\\\\\\]" REGEX_EOS, "$1")) if (regex_replace(t, t, "(.*[^\\\\])\\\\\\]$", "$1"))
continue; continue;
if (regex_replace(t, t, "(.*[^\\\\])\\\\end\\{[a-zA-Z_]*\\*?\\}" REGEX_EOS, "$1")) if (regex_replace(t, t, "(.*[^\\\\])\\\\end\\{[a-zA-Z_]*\\*?\\}$", "$1"))
continue; continue;
if (regex_replace(t, t, "(.*[^\\\\])\\}" REGEX_EOS, "$1")) { if (regex_replace(t, t, "(.*[^\\\\])\\}$", "$1")) {
++open_braces; ++open_braces;
continue; continue;
} }
@ -2825,10 +2825,10 @@ MatchStringAdv::MatchStringAdv(lyx::Buffer & buf, FindAndReplaceOptions const &
regexp2_str = "(" + lead_as_regexp + ").*?" + par_as_string; regexp2_str = "(" + lead_as_regexp + ").*?" + par_as_string;
} }
LYXERR(Debug::FIND, "Setting regexp to : '" << regexp_str << "'"); LYXERR(Debug::FIND, "Setting regexp to : '" << regexp_str << "'");
regexp = lyx::regex(regexp_str); regexp = regex(regexp_str);
LYXERR(Debug::FIND, "Setting regexp2 to: '" << regexp2_str << "'"); LYXERR(Debug::FIND, "Setting regexp2 to: '" << regexp2_str << "'");
regexp2 = lyx::regex(regexp2_str); regexp2 = regex(regexp2_str);
} }
} }

View File

@ -100,7 +100,6 @@ liblyxsupport_a_SOURCES = \
pmprof.h \ pmprof.h \
qstring_helpers.cpp \ qstring_helpers.cpp \
qstring_helpers.h \ qstring_helpers.h \
regex.h \
signals.h \ signals.h \
socktools.cpp \ socktools.cpp \
socktools.h \ socktools.h \

View File

@ -42,7 +42,6 @@
#include <QDir> #include <QDir>
#include "support/lassert.h" #include "support/lassert.h"
#include "support/regex.h"
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_MAGIC_H #ifdef HAVE_MAGIC_H
@ -59,6 +58,7 @@
#include <utility> #include <utility>
#include <fstream> #include <fstream>
#include <regex>
#include <sstream> #include <sstream>
#include <vector> #include <vector>

View File

@ -19,10 +19,11 @@
#include "support/debug.h" #include "support/debug.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/qstring_helpers.h" #include "support/qstring_helpers.h"
#include "support/regex.h"
#include <QDir> #include <QDir>
#include <regex>
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
#include "support/os_cygwin.cpp" #include "support/os_cygwin.cpp"
#elif defined(_WIN32) #elif defined(_WIN32)

View File

@ -1,43 +0,0 @@
// -*- C++ -*-
/**
* \file regexp.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Peter Kümmel
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_REGEXP_H
#define LYX_REGEXP_H
#include <regex>
namespace lyx {
using std::regex;
using std::regex_match;
using std::regex_replace;
using std::regex_search;
using std::sregex_iterator;
using std::smatch;
using std::basic_regex;
using std::regex_error;
using std::match_results;
namespace regex_constants
{
using namespace std::regex_constants;
using std::regex_constants::match_flag_type;
} // namespace regex_constants
} // namespace lyx
// Match Begin and End of String when using ECMAScript (default std::regex)
#define REGEX_BOS "^"
#define REGEX_EOS "$"
#endif // LYX_REGEXP_H

View File

@ -1,9 +1,9 @@
#include <config.h> #include <config.h>
#include "../support/debug.h" #include "../support/debug.h"
#include "../support/regex.h"
#include <iostream> #include <iostream>
#include <regex>
using namespace lyx; using namespace lyx;

View File

@ -27,10 +27,9 @@
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/regex.h"
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <regex>
using namespace std; using namespace std;
using namespace lyx::support; using namespace lyx::support;