Replace std::regex by boost to temporary workaround for Mingw-w64's bug

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98723

(cherry picked from commit 6b52e1f76a)
This commit is contained in:
fujimo-t 2021-11-21 15:46:50 +09:00 committed by Wedge009
parent a6b9e88eb0
commit decc964402
2 changed files with 9 additions and 7 deletions

View file

@ -29,7 +29,7 @@
#include "formula/string_utils.hpp"
#include <regex>
#include <boost/regex.hpp>
static bool is_positive_integer(const std::string& str) {
return str != "0" && std::find_if(str.begin(), str.end(), [](char c) { return !std::isdigit(c); }) == str.end();
@ -264,8 +264,8 @@ void location_palette::adjust_size(const SDL_Rect& target)
button_add_.reset(new location_palette_button(video(), SDL_Rect{ target.x , bottom -= button_y, target.w - 10, button_height }, _("Add"), [this]() {
std::string newid;
if (gui2::dialogs::edit_text::execute(_("New Location Identifier"), "", newid)) {
static const std::regex valid_id("[a-zA-Z0-9_]+");
if(std::regex_match(newid, valid_id)) {
static const boost::regex valid_id("[a-zA-Z0-9_]+");
if(boost::regex_match(newid, valid_id)) {
add_item(newid);
}
else {

View file

@ -13,15 +13,17 @@
See the COPYING file for more details.
*/
#include <regex>
#include "utils/parse_network_address.hpp"
#include <boost/regex.hpp>
#include <string>
std::pair<std::string, std::string> parse_network_address(const std::string& address, const std::string& default_port)
{
const char* address_re = "\\[([[:xdigit:]:]*)\\](:([[:alnum:]]*))?|([[:alnum:]-_\\.]{1,253})(:([[:alnum:]]*))?";
const char* address_re = "\\[([[:xdigit:]:]*)\\](:([[:alnum:]]*))?|([[:alnum:]\\-_\\.]{1,253})(:([[:alnum:]]*))?";
std::smatch m;
std::regex_match(address, m, std::regex(address_re));
boost::smatch m;
boost::regex_match(address, m, boost::regex(address_re));
if(!m[1].str().empty()) {
return { m[1], m[3].str().empty() ? default_port : m[3] };