mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 05:30:06 +00:00
Finish migrating std::regex to RE2
This commit is contained in:
parent
2757c51828
commit
2bd5ec8705
4 changed files with 26 additions and 33 deletions
|
|
@ -2,10 +2,10 @@
|
|||
#include <scwx/util/logger.hpp>
|
||||
|
||||
#include <mutex>
|
||||
#include <regex>
|
||||
|
||||
#include <boost/json.hpp>
|
||||
#include <cpr/cpr.h>
|
||||
#include <re2/re2.h>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -61,16 +61,10 @@ std::string UpdateManager::latest_version() const
|
|||
std::string
|
||||
UpdateManager::Impl::GetVersionString(const std::string& releaseName)
|
||||
{
|
||||
static const std::regex re {"\\d+\\.\\d+\\.\\d+"};
|
||||
std::string versionString {};
|
||||
std::smatch m;
|
||||
static constexpr LazyRE2 re = {"(\\d+\\.\\d+\\.\\d+)"};
|
||||
std::string versionString {};
|
||||
|
||||
std::regex_search(releaseName, m, re);
|
||||
|
||||
if (!m.empty())
|
||||
{
|
||||
versionString = m[0].str();
|
||||
}
|
||||
RE2::PartialMatch(releaseName, *re, &versionString);
|
||||
|
||||
return versionString;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue