]> git.lyx.org Git - features.git/commitdiff
Include standard <regex>
authorYuriy Skalko <yuriy.skalko@gmail.com>
Sat, 28 Nov 2020 23:05:24 +0000 (01:05 +0200)
committerYuriy Skalko <yuriy.skalko@gmail.com>
Sun, 29 Nov 2020 13:27:28 +0000 (15:27 +0200)
20 files changed:
src/BiblioInfo.cpp
src/LaTeX.cpp
src/LaTeXFeatures.cpp
src/LayoutFile.cpp
src/Text3.cpp
src/VCBackend.cpp
src/frontends/qt/GuiCitation.cpp
src/frontends/qt/qt_helpers.cpp
src/frontends/tests/biblio.cpp
src/graphics/epstools.cpp
src/insets/ExternalTransforms.cpp
src/insets/InsetBibtex.cpp
src/insets/InsetListings.cpp
src/lyxfind.cpp
src/support/Makefile.am
src/support/filetools.cpp
src/support/os.cpp
src/support/regex.h [deleted file]
src/tests/check_ListingsCaption.cpp
src/tex2lyx/Preamble.cpp

index 7d67e0849c0a2dca4002df0dfba26709b8de82e6..bdd7b758b259f52181e1500415ba05d388e66751 100644 (file)
 #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("{"));
                }
index 25dffb77a4ddf619a76a243c2c490608c8297e46..31d61441ae786b2f7af61de25d818f1bd3221940 100644 (file)
@@ -36,9 +36,8 @@
 #include "support/Systemcall.h"
 #include "support/os.h"
 
-#include "support/regex.h"
-
 #include <fstream>
+#include <regex>
 #include <stack>
 
 
index fb8a8181cd1c16226c2ca4f443b226e9293dc5ac..4da0e3b598047d0bfced0f615f04e66f4a221ee7 100644 (file)
@@ -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;
index 1ce04aa685974622ddfab01504b53f15047c9be7..7944ad73a2731c2f00bdf94473c5b43a6ab9e8b0 100644 (file)
 #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;
index 1927a2536ae1dbc16e4267796540ce93e25f0df1..aa34971e8c32a9162cf6bb1991a45f8fc451a4a2 100644 (file)
 #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;
index bee398cc4eb6dc4cd866b3cb7c7c5f1bd74e38b2..a1e0ec273867022e57ed40fd993d3314d6c9db6b 100644 (file)
 #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;
index 7a402ed9752e26a823fbe745bae276e4ff137591..a263ddf2cf940e5906c64832851352386a1a51f6 100644 (file)
@@ -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>();
                }
index 108d613042a2cf67f24f4acb37fcde73dfa807bc..ee71aa1b7e46f5b9b8e6aaa3a461e4a935c153d1 100644 (file)
@@ -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 {
index 3696598a3f4c7c130560af2e25f8c5a25d1fb124..9fa7c237df84a76ef3732119b950ff05c17d3d0e 100644 (file)
@@ -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;
        }
 }
index d5674ba7d18205c168bb05318e9165ba34469bc6..5e3dc6c0a95dfb041c0a8fdab2610afc7b4b249a 100644 (file)
@@ -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.
index 9ff5772cd969ee5b7eeb11b65d9e735afd75d623..76578b2ea0814edc6fbc25ef6459fa213483c7c7 100644 (file)
@@ -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';
index 1df99286bebc9951e61dca925d710a23ebf30451..ef7d29f0e8aae8fde1f078b4979dd8c48af8d9ae 100644 (file)
@@ -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 &) 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.
index 7ac940d7421ba52459bf7b3a0888bbe70144cb73..366b22b0c75f77827397648d47839f71268667a7 100644 (file)
@@ -44,8 +44,7 @@
 #include "frontends/alert.h"
 #include "frontends/Application.h"
 
-#include "support/regex.h"
-
+#include <regex>
 #include <sstream>
 
 using namespace std;
index fc7b0b737a71522a0e006d0e7074afe62213e18f..1fff078670b86d47d19a99207c18336729f034d3 100644 (file)
 #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);
        }
 }
 
index bbdc02c1aa2f9275b9760f8b4c1256ae2041e135..83e67eabdf132a6e36a1029899a5391c43bed40d 100644 (file)
@@ -100,7 +100,6 @@ liblyxsupport_a_SOURCES = \
        pmprof.h \
        qstring_helpers.cpp \
        qstring_helpers.h \
-       regex.h \
        signals.h \
        socktools.cpp \
        socktools.h \
index 0233c419080c54fb29c6d7e23c7c2346cb8c5e68..2bcfbc650235d276417d24af8df76fb49793ad9b 100644 (file)
@@ -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>
 
index 3a5c2e59a25eaf4e04032864e5df607a0147a78c..6561fbca38316dad669fc63ad5d609386763a9d4 100644 (file)
 #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 (file)
index 491044c..0000000
+++ /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
index 874e3d67b8754399196beb815fc7a90dbe2bb636..345de5087bd63ec4d8899a5fc208549f9a5cd3f8 100644 (file)
@@ -1,9 +1,9 @@
 #include <config.h>
 
 #include "../support/debug.h"
-#include "../support/regex.h"
 
 #include <iostream>
+#include <regex>
 
 
 using namespace lyx;
index d6deccb90cd8df7416038aedb92c394dbf518091..5d329ae96941e332d42a380f304634d8f9c3f745 100644 (file)
 #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;