[LyX/master] Add default TransformID enum value

Yuriy Skalko yuriy.skalko at gmail.com
Sat Nov 28 23:21:04 UTC 2020


> 
> What remains to be done:
> 
> - remove last remnants of cmake support code in 3rdparty/boost
> 
> - get rid of support/regex.h

Done in the attached patch.

> - Use system boost by default on autotools (this was needed because of interactions between stdlib-debug and system boost). 


Yuriy

-------------- next part --------------
From ac12a63812c534e589e793a66111ef7c0e209427 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Sun, 29 Nov 2020 01:05:24 +0200
Subject: [PATCH] Include standard <regex>

---
 src/BiblioInfo.cpp                  | 10 +++----
 src/LaTeX.cpp                       |  3 +-
 src/LaTeXFeatures.cpp               |  2 +-
 src/LayoutFile.cpp                  |  3 +-
 src/Text3.cpp                       |  2 +-
 src/VCBackend.cpp                   |  2 +-
 src/frontends/qt/GuiCitation.cpp    | 25 ++++++++---------
 src/frontends/qt/qt_helpers.cpp     | 15 +++++-----
 src/frontends/tests/biblio.cpp      | 13 ++++-----
 src/graphics/epstools.cpp           |  7 +++--
 src/insets/ExternalTransforms.cpp   | 11 ++++----
 src/insets/InsetBibtex.cpp          |  6 ++--
 src/insets/InsetListings.cpp        |  3 +-
 src/lyxfind.cpp                     | 34 +++++++++++------------
 src/support/Makefile.am             |  1 -
 src/support/filetools.cpp           |  2 +-
 src/support/os.cpp                  |  3 +-
 src/support/regex.h                 | 43 -----------------------------
 src/tests/check_ListingsCaption.cpp |  2 +-
 src/tex2lyx/Preamble.cpp            |  3 +-
 20 files changed, 70 insertions(+), 120 deletions(-)
 delete mode 100644 src/support/regex.h

diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index 7d67e0849c..bdd7b758b2 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -32,10 +32,10 @@
 #include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
-#include "support/regex.h"
 #include "support/textutils.h"
 
 #include <map>
+#include <regex>
 #include <set>
 
 using namespace std;
@@ -383,8 +383,8 @@ docstring convertLaTeXCommands(docstring const & str)
 		// {\v a} to \v{a} (see #9340).
 		// FIXME: This is a sort of mini-tex2lyx.
 		//        Use the real tex2lyx instead!
-		static lyx::regex const tma_reg("^\\{\\\\[bcCdfGhHkrtuUv]\\s\\w\\}");
-		if (lyx::regex_search(to_utf8(val), tma_reg)) {
+		static regex const tma_reg("^\\{\\\\[bcCdfGhHkrtuUv]\\s\\w\\}");
+		if (regex_search(to_utf8(val), tma_reg)) {
 			val = val.substr(1);
 			val.replace(2, 1, from_ascii("{"));
 			continue;
@@ -411,8 +411,8 @@ docstring convertLaTeXCommands(docstring const & str)
 		// look for that and change it, if necessary.
 		// FIXME: This is a sort of mini-tex2lyx.
 		//        Use the real tex2lyx instead!
-		static lyx::regex const reg("^\\\\\\W\\w");
-		if (lyx::regex_search(to_utf8(val), reg)) {
+		static regex const reg("^\\\\\\W\\w");
+		if (regex_search(to_utf8(val), reg)) {
 			val.insert(3, from_ascii("}"));
 			val.insert(2, from_ascii("{"));
 		}
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index 25dffb77a4..31d61441ae 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -36,9 +36,8 @@
 #include "support/Systemcall.h"
 #include "support/os.h"
 
-#include "support/regex.h"
-
 #include <fstream>
+#include <regex>
 #include <stack>
 
 
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index b9652d9ac7..e74942f74d 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -40,9 +40,9 @@
 #include "support/docstring.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
-#include "support/regex.h"
 
 #include <algorithm>
+#include <regex>
 
 
 using namespace std;
diff --git a/src/LayoutFile.cpp b/src/LayoutFile.cpp
index 1ce04aa685..7944ad73a2 100644
--- a/src/LayoutFile.cpp
+++ b/src/LayoutFile.cpp
@@ -19,11 +19,10 @@
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lassert.h"
-
-#include "support/regex.h"
 #include "support/TempFile.h"
 
 #include <fstream>
+#include <regex>
 
 using namespace std;
 using namespace lyx::support;
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 1927a2536a..aa34971e8c 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -72,13 +72,13 @@
 #include "support/lassert.h"
 #include "support/limited_stack.h"
 #include "support/lstrings.h"
-#include "support/regex.h"
 
 #include "mathed/InsetMathHull.h"
 #include "mathed/InsetMathMacroTemplate.h"
 #include "lyxfind.h"
 
 #include <clocale>
+#include <regex>
 #include <sstream>
 
 using namespace std;
diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index bee398cc4e..a1e0ec2738 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -26,11 +26,11 @@
 #include "support/lstrings.h"
 #include "support/PathChanger.h"
 #include "support/Systemcall.h"
-#include "support/regex.h"
 #include "support/TempFile.h"
 
 #include <fstream>
 #include <iomanip>
+#include <regex>
 #include <sstream>
 
 using namespace std;
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index 7a402ed975..a263ddf2cf 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -45,9 +45,8 @@
 
 #undef KeyPress
 
-#include "support/regex.h"
-
 #include <algorithm>
+#include <regex>
 #include <string>
 #include <vector>
 
@@ -987,21 +986,21 @@ static docstring escape_special_chars(docstring const & expr)
 {
 	// Search for all chars '.|*?+(){}[^$]\'
 	// Note that '[', ']', and '\' must be escaped.
-	static const lyx::regex reg("[.|*?+(){}^$\\[\\]\\\\]");
+	static const regex reg("[.|*?+(){}^$\\[\\]\\\\]");
 
 	// $& is an ECMAScript format expression that expands to all
 	// of the current match
 	// To prefix a matched expression with a single literal backslash, we
 	// need to escape it for the C++ compiler and use:
 	// 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> const & keys_to_search, bool only_keys,
  	docstring const & search_expression, docstring const & field,
-	bool case_sensitive, bool regex)
+	bool case_sensitive, bool re)
 {
 	vector<docstring> foundKeys;
 
@@ -1009,17 +1008,17 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
 	if (expr.empty())
 		return foundKeys;
 
-	if (!regex)
+	if (!re)
 		// 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);
 
-	lyx::regex reg_exp;
+	regex reg_exp;
 	try {
 		reg_exp.assign(to_utf8(expr), case_sensitive ?
-			lyx::regex_constants::ECMAScript : lyx::regex_constants::icase);
-	} catch (lyx::regex_error const & e) {
-		// lyx::regex throws an exception if the regular expression is not
+			regex_constants::ECMAScript : regex_constants::icase);
+	} catch (regex_error const & e) {
+		// regex throws an exception if the regular expression is not
 		// valid.
 		LYXERR(Debug::GUI, e.what());
 		return vector<docstring>();
@@ -1045,10 +1044,10 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
 			continue;
 
 		try {
-			if (lyx::regex_search(sdata, reg_exp))
+			if (regex_search(sdata, reg_exp))
 				foundKeys.push_back(*it);
 		}
-		catch (lyx::regex_error const & e) {
+		catch (regex_error const & e) {
 			LYXERR(Debug::GUI, e.what());
 			return vector<docstring>();
 		}
diff --git a/src/frontends/qt/qt_helpers.cpp b/src/frontends/qt/qt_helpers.cpp
index 108d613042..ee71aa1b7e 100644
--- a/src/frontends/qt/qt_helpers.cpp
+++ b/src/frontends/qt/qt_helpers.cpp
@@ -58,8 +58,7 @@
 
 // for FileFilter.
 // FIXME: Remove
-#include "support/regex.h"
-
+#include <regex>
 
 using namespace std;
 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
 	// "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,
 	// while ignoring surrounding spaces.
-	static lyx::regex const block_re(" *([^ ,}]+) *,? *");
+	static regex const block_re(" *([^ ,}]+) *,? *");
 
 	string pattern;
 
@@ -624,14 +623,14 @@ FileFilterList::FileFilterList(docstring const & qt_style_filter)
 
 	// Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)"
 	// into individual filters.
-	static lyx::regex const separator_re(";;");
+	static regex const separator_re(";;");
 
 	string::const_iterator it = filter.begin();
 	string::const_iterator const end = filter.end();
 	while (true) {
 		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));
 			break;
 		}
@@ -650,10 +649,10 @@ void FileFilterList::parse_filter(string const & filter)
 {
 	// Matches "TeX documents (plain) (*.tex)",
 	// 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;
-	if (!lyx::regex_search(filter, what, filter_re)) {
+	if (!regex_search(filter, what, filter_re)) {
 		// Just a glob, no description.
 		filters_.push_back(Filter(docstring(), trim(filter)));
 	} else {
diff --git a/src/frontends/tests/biblio.cpp b/src/frontends/tests/biblio.cpp
index 3696598a3f..9fa7c237df 100644
--- a/src/frontends/tests/biblio.cpp
+++ b/src/frontends/tests/biblio.cpp
@@ -2,8 +2,7 @@
 
 #include <iostream>
 #include <map>
-
-#include "support/regex.h"
+#include <regex>
 
 using namespace std;
 
@@ -16,13 +15,13 @@ string const escape_special_chars(string const & expr)
 {
 	// Search for all chars '.|*?+(){}[^$]\'
 	// Note that '[', ']', and '\' must be escaped.
-	lyx::regex reg("[.|*?+(){}^$\\[\\]\\\\]");
+	regex reg("[.|*?+(){}^$\\[\\]\\\\]");
 
 	// $& is a ECMAScript format expression that expands to all
 	// of the current match
 	// 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, "\\$&");
+	return regex_replace(expr, reg, "\\$&");
 }
 
 
@@ -49,11 +48,11 @@ public:
 
 		// Attempts to find a match for the current RE
 		// somewhere in data.
-		return lyx::regex_search(data, regex_);
+		return regex_search(data, regex_);
 	}
 private:
 	InfoMap const map_;
-	mutable lyx::regex regex_;
+	mutable regex regex_;
 };
 
 
@@ -77,7 +76,7 @@ void test_RegexMatch()
 		cout << rm("hello") << endl;
 		cout << rm("hei") << endl;
 	}
-	catch (lyx::regex_error & regerr) {
+	catch (regex_error & regerr) {
 		cout << regerr.what() << endl;
 	}
 }
diff --git a/src/graphics/epstools.cpp b/src/graphics/epstools.cpp
index d5674ba7d1..5e3dc6c0a9 100644
--- a/src/graphics/epstools.cpp
+++ b/src/graphics/epstools.cpp
@@ -29,7 +29,8 @@
 #include "support/docstream.h"
 #include "support/filetools.h"
 #include "support/FileName.h"
-#include "support/regex.h"
+
+#include <regex>
 
 using namespace std;
 using namespace lyx::support;
@@ -58,13 +59,13 @@ string const readBB_from_PSFile(FileName const & file)
 		return string();
 	}
 
-	static lyx::regex bbox_re("^%%BoundingBox:\\s*([-]*[[:digit:]]+)"
+	static regex bbox_re("^%%BoundingBox:\\s*([-]*[[:digit:]]+)"
 		"\\s+([-]*[[:digit:]]+)\\s+([-]*[[:digit:]]+)\\s+([-]*[[:digit:]]+)");
 	ifstream is(file_.toFilesystemEncoding().c_str());
 	while (is) {
 		string s;
 		getline(is,s);
-		lyx::smatch what;
+		smatch what;
 		if (regex_match(s, what, bbox_re)) {
 			// Our callers expect the tokens in the string
 			// separated by single spaces.
diff --git a/src/insets/ExternalTransforms.cpp b/src/insets/ExternalTransforms.cpp
index 9ff5772cd9..76578b2ea0 100644
--- a/src/insets/ExternalTransforms.cpp
+++ b/src/insets/ExternalTransforms.cpp
@@ -18,9 +18,8 @@
 #include "support/lyxlib.h" // float_equal
 #include "support/Translator.h"
 
-#include "support/regex.h"
-
 #include <cmath> // abs
+#include <regex>
 #include <sstream>
 
 using namespace std;
@@ -282,8 +281,8 @@ string const sanitizeLatexOption(string const & input)
 	// Strip any leading commas
 	// "[,,,,foo..." -> "foo..." ("foo..." may be empty)
 	string output;
-	lyx::smatch what;
-	static lyx::regex const front("^( *\\[,*)(.*)$");
+	smatch what;
+	static regex const front("^( *\\[,*)(.*)$");
 
 	if (!regex_match(it, end, what, front)) {
 		lyxerr << "Unable to sanitize LaTeX \"Option\": "
@@ -295,7 +294,7 @@ string const sanitizeLatexOption(string const & input)
 	// Replace any consecutive commas with a single one
 	// "foo,,,,bar" -> "foo,bar"
 	// with iterator now pointing to 'b'
-	static lyx::regex const commas("([^,]*)(,,*)(.*)$");
+	static regex const commas("([^,]*)(,,*)(.*)$");
 	for (; it != end;) {
 		if (!regex_match(it, end, what, commas)) {
 			output += string(it, end);
@@ -307,7 +306,7 @@ string const sanitizeLatexOption(string const & input)
 
 	// Strip any trailing commas
 	// "...foo,,,]" -> "...foo" ("...foo,,," may be empty)
-	static lyx::regex const back("^(.*[^,])?,*\\] *$");
+	static regex const back("^(.*[^,])?,*\\] *$");
 	if (!regex_match(output, what, back)) {
 		lyxerr << "Unable to sanitize LaTeX \"Option\": "
 		       << output << '\n';
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index 29113c15bd..660d03b71d 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -43,7 +43,6 @@
 #include "support/ExceptionMessage.h"
 #include "support/FileNameList.h"
 #include "support/filetools.h"
-#include "support/regex.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/os.h"
@@ -52,6 +51,7 @@
 
 #include <limits>
 #include <map>
+#include <regex>
 #include <utility>
 
 #include <iostream>
@@ -1188,8 +1188,8 @@ void InsetBibtex::docbook(XMLStream & xs, OutputParams &) const
 		string html = to_utf8(bibinfo.getInfo(entry.key(), buffer(), ci));
 		regex tagRegex("<span class=\"bib-([^\"]*)\">([^<]*)</span>");
 		smatch match;
-		auto tagIt = lyx::sregex_iterator(html.cbegin(), html.cend(), tagRegex, regex_constants::match_default);
-		auto tagEnd = lyx::sregex_iterator();
+		auto tagIt = sregex_iterator(html.cbegin(), html.cend(), tagRegex, regex_constants::match_default);
+		auto tagEnd = sregex_iterator();
 		map<string, string> delayedTags;
 
 		// Read all tags from HTML and convert those that have a 1:1 matching.
diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp
index 2e2e616f3f..03882e0d50 100644
--- a/src/insets/InsetListings.cpp
+++ b/src/insets/InsetListings.cpp
@@ -44,8 +44,7 @@
 #include "frontends/alert.h"
 #include "frontends/Application.h"
 
-#include "support/regex.h"
-
+#include <regex>
 #include <sstream>
 
 using namespace std;
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index fc7b0b737a..1fff078670 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -46,10 +46,10 @@
 #include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
-
-#include "support/regex.h"
 #include "support/textutils.h"
+
 #include <map>
+#include <regex>
 
 using namespace std;
 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,
 		   string const & replacestr)
 {
-	lyx::regex e(searchstr, regex_constants::ECMAScript);
+	regex e(searchstr, regex_constants::ECMAScript);
 	ostringstream 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
 	bool rv = (s != oss.str());
 	t = oss.str();
@@ -881,9 +881,9 @@ private:
 	// normalized string to search
 	string par_as_string;
 	// regular expression to use for searching
-	lyx::regex regexp;
+	regex regexp;
 	// same as regexp, but prefixed with a ".*?"
-	lyx::regex regexp2;
+	regex regexp2;
 	// leading format material as string
 	string 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]
 	// Kornel: Added textsl, textsf, textit, texttt and noun
 	// + 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)\\*?)\\{", "")
-	       || regex_replace(t, t, REGEX_BOS "\\$", "")
-	       || regex_replace(t, t, REGEX_BOS "\\\\\\[", "")
-	       || regex_replace(t, t, REGEX_BOS " ?\\\\item\\{[a-z]+\\}", "")
-	       || regex_replace(t, t, REGEX_BOS "\\\\begin\\{[a-zA-Z_]*\\*?\\}", ""))
+	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_replace(t, t, "^\\\\\\[", "")
+	       || regex_replace(t, t, "^ ?\\\\item\\{[a-z]+\\}", "")
+	       || regex_replace(t, t, "^\\\\begin\\{[a-zA-Z_]*\\*?\\}", ""))
 	       ;
 	LYXERR(Debug::FIND, "  after removing leading $, \\[ , \\emph{, \\textbf{, etc.: '" << t << "'");
 	return s.find(t);
@@ -2688,13 +2688,13 @@ static int identifyClosing(string & t)
 	int open_braces = 0;
 	do {
 		LYXERR(Debug::FIND, "identifyClosing(): t now is '" << t << "'");
-		if (regex_replace(t, t, "(.*[^\\\\])\\$" REGEX_EOS, "$1"))
+		if (regex_replace(t, t, "(.*[^\\\\])\\$$", "$1"))
 			continue;
-		if (regex_replace(t, t, "(.*[^\\\\])\\\\\\]" REGEX_EOS, "$1"))
+		if (regex_replace(t, t, "(.*[^\\\\])\\\\\\]$", "$1"))
 			continue;
-		if (regex_replace(t, t, "(.*[^\\\\])\\\\end\\{[a-zA-Z_]*\\*?\\}" REGEX_EOS, "$1"))
+		if (regex_replace(t, t, "(.*[^\\\\])\\\\end\\{[a-zA-Z_]*\\*?\\}$", "$1"))
 			continue;
-		if (regex_replace(t, t, "(.*[^\\\\])\\}" REGEX_EOS, "$1")) {
+		if (regex_replace(t, t, "(.*[^\\\\])\\}$", "$1")) {
 			++open_braces;
 			continue;
 		}
@@ -2825,10 +2825,10 @@ MatchStringAdv::MatchStringAdv(lyx::Buffer & buf, FindAndReplaceOptions const &
 			regexp2_str = "(" + lead_as_regexp + ").*?" + par_as_string;
 		}
 		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 << "'");
-		regexp2 = lyx::regex(regexp2_str);
+		regexp2 = regex(regexp2_str);
 	}
 }
 
diff --git a/src/support/Makefile.am b/src/support/Makefile.am
index bbdc02c1aa..83e67eabdf 100644
--- a/src/support/Makefile.am
+++ b/src/support/Makefile.am
@@ -100,7 +100,6 @@ liblyxsupport_a_SOURCES = \
 	pmprof.h \
 	qstring_helpers.cpp \
 	qstring_helpers.h \
-	regex.h \
 	signals.h \
 	socktools.cpp \
 	socktools.h \
diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp
index 0233c41908..2bcfbc6502 100644
--- a/src/support/filetools.cpp
+++ b/src/support/filetools.cpp
@@ -42,7 +42,6 @@
 #include <QDir>
 
 #include "support/lassert.h"
-#include "support/regex.h"
 
 #include <fcntl.h>
 #ifdef HAVE_MAGIC_H
@@ -59,6 +58,7 @@
 
 #include <utility>
 #include <fstream>
+#include <regex>
 #include <sstream>
 #include <vector>
 
diff --git a/src/support/os.cpp b/src/support/os.cpp
index 3a5c2e59a2..6561fbca38 100644
--- a/src/support/os.cpp
+++ b/src/support/os.cpp
@@ -19,10 +19,11 @@
 #include "support/debug.h"
 #include "support/filetools.h"
 #include "support/qstring_helpers.h"
-#include "support/regex.h"
 
 #include <QDir>
 
+#include <regex>
+
 #if defined(__CYGWIN__)
 #include "support/os_cygwin.cpp"
 #elif defined(_WIN32)
diff --git a/src/support/regex.h b/src/support/regex.h
deleted file mode 100644
index 491044ca1f..0000000000
--- a/src/support/regex.h
+++ /dev/null
@@ -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
diff --git a/src/tests/check_ListingsCaption.cpp b/src/tests/check_ListingsCaption.cpp
index 874e3d67b8..345de5087b 100644
--- a/src/tests/check_ListingsCaption.cpp
+++ b/src/tests/check_ListingsCaption.cpp
@@ -1,9 +1,9 @@
 #include <config.h>
 
 #include "../support/debug.h"
-#include "../support/regex.h"
 
 #include <iostream>
+#include <regex>
 
 
 using namespace lyx;
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index d6deccb90c..5d329ae969 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -27,10 +27,9 @@
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
-#include "support/regex.h"
-
 #include <algorithm>
 #include <iostream>
+#include <regex>
 
 using namespace std;
 using namespace lyx::support;
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list