Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/ctre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <functional>

#include "main.h"
#include <ctre.hpp>
#include <ctre-unicode.hpp>

using RegexFn = std::function<int(const std::string_view &)>;
using RegexMap = std::unordered_map<std::string, RegexFn>;
Expand All @@ -16,7 +16,7 @@ using RegexMap = std::unordered_map<std::string, RegexFn>;
[](const std::string_view &sv) -> int \
{ \
int cnt = 0; \
for (auto match : ctre::range<STR>(sv)) \
for (auto match : ctre::multiline_range<STR>(sv)) \
cnt++; \
return cnt; \
} \
Expand All @@ -26,22 +26,22 @@ RegexMap remap = {
ENTRY("(.*?,){13}z"),
ENTRY("[a-z]shing"),
ENTRY("Twain"),
// ENTRY("(?i)Twain"),
ENTRY("(?i)Twain"),
ENTRY("[a-z]shing"),
ENTRY("Huck[a-zA-Z]+|Saw[a-zA-Z]+"),
// ENTRY("\\b\\w+nn\\b"),
ENTRY("\\b\\w+nn\\b"),
ENTRY("[a-q][^u-z]{13}x"),
ENTRY("Tom|Sawyer|Huckleberry|Finn"),
// ENTRY("(?i)Tom|Sawyer|Huckleberry|Finn"),
ENTRY("(?i)Tom|Sawyer|Huckleberry|Finn"),
ENTRY(".{0,2}(Tom|Sawyer|Huckleberry|Finn)"),
ENTRY(".{2,4}(Tom|Sawyer|Huckleberry|Finn)"),
ENTRY("Tom.{10,25}river|river.{10,25}Tom"),
ENTRY("[a-zA-Z]+ing"),
ENTRY("\\s[a-zA-Z]{0,12}ing\\s"),
ENTRY("([A-Za-z]awyer|[A-Za-z]inn)\\s"),
ENTRY("[\"'][^\"']{0,30}[?!\\.][\"']"),
ENTRY("\u221E|\u2713")
// ENTRY("\\p{Sm}")
ENTRY("\u221E|\u2713"),
ENTRY("\\p{Sm}")
};

extern "C" int ctre_find_all(char *pattern, char *subject, int subject_len, int repeat, struct result *res)
Expand Down
2 changes: 1 addition & 1 deletion vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ AddExternalProject(
"ctre"
"ctre"
"https://github.com/hanickadot/compile-time-regular-expressions.git"
"master"
"main"
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/local
)

Expand Down