summaryrefslogtreecommitdiffstats
path: root/src/markdown.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-03-02 20:40:36 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-03-02 21:35:36 (GMT)
commit3d4f0313d20cc8f71ade094faa006a2171ff29c2 (patch)
tree0d84aff63e7b1bbd7bc46891771a90bc64ee58dc /src/markdown.cpp
parent30d347bf8046775d6eab9bd8f70dbf3c3204e7b7 (diff)
downloadDoxygen-3d4f0313d20cc8f71ade094faa006a2171ff29c2.zip
Doxygen-3d4f0313d20cc8f71ade094faa006a2171ff29c2.tar.gz
Doxygen-3d4f0313d20cc8f71ade094faa006a2171ff29c2.tar.bz2
Refactoring: replaced std::regex with own much faster implementation
Diffstat (limited to 'src/markdown.cpp')
-rw-r--r--src/markdown.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 8ac2e5f..185a43e 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -37,7 +37,6 @@
#include <unordered_map>
#include <functional>
-#include <regex>
#include "markdown.h"
#include "growbuf.h"
@@ -51,6 +50,7 @@
#include "section.h"
#include "message.h"
#include "portable.h"
+#include "regex.h"
#if !defined(NDEBUG)
#define ENABLE_TRACING
@@ -1472,13 +1472,13 @@ static QCString extractTitleId(QCString &title, int level)
{
TRACE(title.data());
// match e.g. '{#id-b11} ' and capture 'id-b11'
- static const std::regex r2("\\{#([a-z_A-Z][a-z_A-Z0-9\\-]*)\\}[[:space:]]*$", std::regex::optimize);
- std::smatch match;
+ static const reg::Ex r2(R"({#(\a[\w-]*)}\s*$)");
+ reg::Match match;
std::string ti = title.str();
- if (std::regex_search(ti,match,r2))
+ if (reg::search(ti,match,r2))
{
std::string id = match[1].str();
- title = title.left(match.position());
+ title = title.left((int)match.position());
//printf("found match id='%s' title=%s\n",id.c_str(),title.data());
return id;
}