migrate to boost::regex

This commit is contained in:
2025-03-21 22:43:44 +03:00
parent 1fa69c3a69
commit d83f106a91
6 changed files with 45 additions and 35 deletions

View File

@@ -19,9 +19,9 @@
#endif
#include <regex>
#include <string>
#include "settings/settings.h"
#include <QWidget>
#include <fstream>
#include <boost/regex.hpp>
#ifdef BUILD_OFD_BINARYEYE_SCAN
@@ -97,10 +97,10 @@ std::wstring substring_from_to(std::wstring& text, std::wstring from, std::wstri
std::wstring substring;
std::wregex start_regex(from);
std::wregex end_regex(to);
boost::wregex start_regex(from);
boost::wregex end_regex(to);
for (std::wsregex_iterator it{text.begin(), text.end(), start_regex}, end{};
for (boost::wsregex_iterator it{text.begin(), text.end(), start_regex}, end{};
it != end; it++) {
start_pos = it->position() + it->str().size();
break;
@@ -109,7 +109,7 @@ std::wstring substring_from_to(std::wstring& text, std::wstring from, std::wstri
if(text == from_utf8("")) return text;
substring = text.substr(start_pos, text.size());
for (std::wsregex_iterator it{substring.begin(), substring.end(), end_regex}, end{};
for (boost::wsregex_iterator it{substring.begin(), substring.end(), end_regex}, end{};
it != end; it++) {
end_pos = it->position();
break;
@@ -131,10 +131,10 @@ std::wstring trim_html_response(std::wstring& check) {
}
std::vector<std::wstring> find_in_html(std::string& html, std::string regex, std::string html_start, std::string html_end) {
std::regex searching_regex(regex);
boost::regex searching_regex(regex);
std::vector<std::wstring> parsed;
for (std::sregex_iterator it{html.begin(), html.end(), searching_regex}, end{};
for (boost::sregex_iterator it{html.begin(), html.end(), searching_regex}, end{};
it != end; it++) {
std::wstring found_entry = from_utf8(it->str());