|
31 | 31 | #include <vector> |
32 | 32 | #include <mutex> |
33 | 33 |
|
34 | | -static_assert(RE_CASE_INSENSITIVE == PCRE2_CASELESS, "Update RE_CASE_INSERSITIVE for current PCRE2 version."); |
35 | | -static_assert(RE_UNANCHORED == PCRE2_MULTILINE, "Update RE_MULTILINE for current PCRE2 version."); |
| 34 | +static_assert(RE_CASE_INSENSITIVE == PCRE2_CASELESS, "Update RE_CASE_INSENSITIVE for current PCRE2 version."); |
| 35 | +static_assert(RE_UNANCHORED == PCRE2_MULTILINE, "Update RE_UNANCHORED for current PCRE2 version."); |
36 | 36 | static_assert(RE_ANCHORED == PCRE2_ANCHORED, "Update RE_ANCHORED for current PCRE2 version."); |
| 37 | +static_assert(RE_NOTEMPTY == PCRE2_NOTEMPTY, "Update RE_NOTEMPTY for current PCRE2 version."); |
37 | 38 |
|
38 | 39 | //---------------------------------------------------------------------------- |
39 | 40 | namespace |
@@ -296,28 +297,28 @@ Regex::compile(std::string_view pattern, std::string &error, int &erroroffset, u |
296 | 297 |
|
297 | 298 | //---------------------------------------------------------------------------- |
298 | 299 | bool |
299 | | -Regex::exec(std::string_view subject) const |
| 300 | +Regex::exec(std::string_view subject, uint32_t flags) const |
300 | 301 | { |
301 | 302 | if (_Code::get(_code) == nullptr) { |
302 | 303 | return false; |
303 | 304 | } |
304 | 305 | RegexMatches matches; |
305 | 306 |
|
306 | | - int count = this->exec(subject, matches); |
| 307 | + int count = this->exec(subject, matches, flags); |
307 | 308 | return count > 0; |
308 | 309 | } |
309 | 310 |
|
310 | 311 | //---------------------------------------------------------------------------- |
311 | 312 | int32_t |
312 | | -Regex::exec(std::string_view subject, RegexMatches &matches) const |
| 313 | +Regex::exec(std::string_view subject, RegexMatches &matches, uint32_t flags) const |
313 | 314 | { |
314 | 315 | auto code = _Code::get(_code); |
315 | 316 |
|
316 | 317 | // check if there is a compiled regex |
317 | 318 | if (code == nullptr) { |
318 | 319 | return 0; |
319 | 320 | } |
320 | | - int count = pcre2_match(code, reinterpret_cast<PCRE2_SPTR>(subject.data()), subject.size(), 0, 0, |
| 321 | + int count = pcre2_match(code, reinterpret_cast<PCRE2_SPTR>(subject.data()), subject.size(), 0, flags, |
321 | 322 | RegexMatches::_MatchData::get(matches._match_data), RegexContext::get_instance()->get_match_context()); |
322 | 323 |
|
323 | 324 | matches._size = count; |
|
0 commit comments