From b4a17ad0dfbb7e85f4e1d82f5c4afb61aeb7fcac Mon Sep 17 00:00:00 2001 From: zmy Date: Mon, 26 May 2025 15:06:49 +0800 Subject: [PATCH] Remove the implicit use of the regex_constants::match_any flag from regex_match and regex_search to improve performance in cases where match results are not needed. (#251) --- include/boost/regex/v5/regex_match.hpp | 6 +++--- include/boost/regex/v5/regex_search.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/regex/v5/regex_match.hpp b/include/boost/regex/v5/regex_match.hpp index f70a6e62b..bfa4be1a3 100644 --- a/include/boost/regex/v5/regex_match.hpp +++ b/include/boost/regex/v5/regex_match.hpp @@ -47,7 +47,7 @@ bool regex_match(iterator first, iterator last, match_flag_type flags = match_default) { match_results m; - return regex_match(first, last, m, e, flags | regex_constants::match_any); + return regex_match(first, last, m, e, flags); } // // query_match convenience interfaces: @@ -75,7 +75,7 @@ inline bool regex_match(const charT* str, match_flag_type flags = match_default) { match_results m; - return regex_match(str, str + traits::length(str), m, e, flags | regex_constants::match_any); + return regex_match(str, str + traits::length(str), m, e, flags); } BOOST_REGEX_MODULE_EXPORT template @@ -85,7 +85,7 @@ inline bool regex_match(const std::basic_string& s, { typedef typename std::basic_string::const_iterator iterator; match_results m; - return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any); + return regex_match(s.begin(), s.end(), m, e, flags); } diff --git a/include/boost/regex/v5/regex_search.hpp b/include/boost/regex/v5/regex_search.hpp index fbb826b28..5057f8c3c 100644 --- a/include/boost/regex/v5/regex_search.hpp +++ b/include/boost/regex/v5/regex_search.hpp @@ -79,7 +79,7 @@ bool regex_search(BidiIterator first, BidiIterator last, match_results m; typedef typename match_results::allocator_type match_alloc_type; - BOOST_REGEX_DETAIL_NS::perl_matcher matcher(first, last, m, e, flags | regex_constants::match_any, first); + BOOST_REGEX_DETAIL_NS::perl_matcher matcher(first, last, m, e, flags, first); return BOOST_REGEX_DETAIL_NS::factory_find(matcher); }