6#include <mstd/mstd.hpp>
10#include <unordered_map>
14#pragma region config.hpp
15#ifndef _PCRE2CPP_CONFIG_HPP_
16 #define _PCRE2CPP_CONFIG_HPP_
39 #pragma region VERSION
44 #define PCRE2CPP_VERSION_MAJOR 1
49 #define PCRE2CPP_VERSION_MINOR 2
54 #define PCRE2CPP_VERSION_PATCH 4
60 #define _PCRE2CPP_STRINGIFY_HELPER(x) #x
66 #define _PCRE2CPP_VERSION_TO_STRING(major, minor, patch) \
67 _PCRE2CPP_STRINGIFY_HELPER(major) "." _PCRE2CPP_STRINGIFY_HELPER(minor) "." _PCRE2CPP_STRINGIFY_HELPER(patch)
72 #define _PCRE2CPP_VERSION_TO_INT(major, minor, patch) (major * 100 + minor * 10 + patch)
78 #define PCRE2CPP_VERSION_STRING \
79 _PCRE2CPP_VERSION_TO_STRING(PCRE2CPP_VERSION_MAJOR, PCRE2CPP_VERSION_MINOR, PCRE2CPP_VERSION_PATCH)
84 #define PCRE2CPP_VERSION_INT _PCRE2CPP_VERSION_TO_INT(PCRE2CPP_VERSION_MAJOR, PCRE2CPP_VERSION_MINOR, PCRE2CPP_VERSION_PATCH)
89 #define PCRE2CPP_VERSION PCRE2CPP_VERSION_STRING
92 #pragma region LAST_UPDATE
97 #define PCRE2CPP_LAST_UPDATE_DAY 07
102 #define PCRE2CPP_LAST_UPDATE_MONTH 04
107 #define PCRE2CPP_LAST_UPDATE_YEAR 2026
113 #define _PCRE2CPP_LAST_UPDATE_DATE_HELPER(day, month, year) \
114 _PCRE2CPP_STRINGIFY_HELPER(day) "." _PCRE2CPP_STRINGIFY_HELPER(month) "." _PCRE2CPP_STRINGIFY_HELPER(year)
120 #define PCRE2CPP_LAST_UPDATE_DATE \
121 _PCRE2CPP_LAST_UPDATE_DATE_HELPER(PCRE2CPP_LAST_UPDATE_DAY, PCRE2CPP_LAST_UPDATE_MONTH, PCRE2CPP_LAST_UPDATE_YEAR)
124 #pragma region CXX_VERSIONS
132 #define _PCRE2CPP_HAS_CXX17 __cplusplus >= 201703l
135 #define _PCRE2CPP_HAS_CXX17 _HAS_CXX17
143 #ifndef PCRE2CPP_ENABLE_CXX20
144 #define _PCRE2CPP_HAS_CXX20 0
145 #elif !defined(_HAS_CXX20)
147 #define _PCRE2CPP_HAS_CXX20 __cplusplus >= 202002l
150 #define _PCRE2CPP_HAS_CXX20 _HAS_CXX20
166 #ifdef PCRE2CPP_CHANGE_ASSERTS_TO_EXCEPTIONS
167 #define _PCRE2CPP_HAS_EXCEPTIONS _PCRE2CPP_HAS_CXX17
168 #define _PCRE2CPP_HAS_ASSERTS 0
170 #define _PCRE2CPP_HAS_EXCEPTIONS 0
171 #define _PCRE2CPP_HAS_ASSERTS _PCRE2CPP_HAS_CXX17
174 #if _PCRE2CPP_HAS_EXCEPTIONS
175 #define _PCRE2CPP_NOEXCEPT noexcept
177 #define _PCRE2CPP_NOEXCEPT
180 #pragma region UTFS_ENABLED
199 #ifdef PCRE2CPP_DISABLE_UTF8
200 #define _PCRE2CPP_HAS_UTF8 0
202 #define _PCRE2CPP_HAS_UTF8 1
203 #define PCRE2_CODE_UNIT_WIDTH 8
206 #ifdef PCRE2CPP_DISABLE_UTF16
207 #define _PCRE2CPP_HAS_UTF16 0
209 #define _PCRE2CPP_HAS_UTF16 1
210 #ifndef PCRE2_CODE_UNIT_WIDTH
211 #define PCRE2_CODE_UNIT_WIDTH 16
213 #define PCRE2_CODE_UNIT_WIDTH 0
217 #ifdef PCRE2CPP_DISABLE_UTF32
218 #define _PCRE2CPP_HAS_UTF32 0
220 #define _PCRE2CPP_HAS_UTF32 1
221 #ifndef PCRE2_CODE_UNIT_WIDTH
222 #define PCRE2_CODE_UNIT_WIDTH 32
224 #define PCRE2_CODE_UNIT_WIDTH 0
229 #pragma region VERSION_SPECIFIC_VALUES
235 #if _PCRE2CPP_HAS_CXX17
236 #define _PCRE2CPP_CONSTEXPR17 constexpr
238 #define _PCRE2CPP_CONSTEXPR17
252 #if _PCRE2CPP_HAS_CXX20
253 #define _PCRE2CPP_CONSTEXPR20 constexpr
254 #define _PCRE2CPP_REQUIRES(condition) requires (condition)
256 #define _PCRE2CPP_CONSTEXPR20
257 #define _PCRE2CPP_REQUIRES(condition)
266 #define _PCRE2CPP_MESSAGE(MESSAGE) _MSTD_MESSAGE(MESSAGE)
271 #define _PCRE2CPP_WARNING(MESSAGE) _MSTD_WARNING(MESSAGE)
276 #define _PCRE2CPP_ERROR(MESSAGE) _MSTD_ERROR(MESSAGE)
280#pragma region libs.hpp
281#ifndef _PCRE2CPP_LIBS_HPP_
282 #define _PCRE2CPP_LIBS_HPP_
285 #if !_PCRE2CPP_HAS_CXX17
290 #if _PCRE2CPP_HAS_EXCEPTIONS
297#pragma region types.hpp
298#ifndef _PCRE2CPP_TYPES_HPP_
299 #define _PCRE2CPP_TYPES_HPP_
302 #if !_PCRE2CPP_HAS_CXX17
311 template<utf_type utf>
315 #if _PCRE2CPP_HAS_EXCEPTIONS
316 template<utf_type utf>
317 class basic_pcre2cpp_exception;
318 template<utf_type utf>
319 class basic_regex_exception;
320 template<utf_type utf>
321 class basic_match_result_exception;
324 template<utf_type utf>
327 template<utf_type utf>
329 template<utf_type utf>
336#pragma region utils_pcre2_data.hpp
337#ifndef _PCRE2CPP_PCRE2_DATA_HPP_
338 #define _PCRE2CPP_PCRE2_DATA_HPP_
342 #if !_PCRE2CPP_HAS_CXX17
353 #if _PCRE2CPP_HAS_UTF8
356 #if _PCRE2CPP_HAS_UTF16
359 #if _PCRE2CPP_HAS_UTF32
371 template<utf_type utf>
375 #if _PCRE2CPP_HAS_UTF8
398 #pragma region PCRE2_STRING
405 #pragma region CPP_STRING
421 #pragma region UTF_INFO
428 #pragma region CODE_FUNCTIONS
436 #pragma region MATCH_DATA_FUNCTIONS
444 #pragma region MATCH_FUNCTIONS
451 #pragma region OVECTOR_FUNCTIONS
458 #pragma region ERROR_FUNCTIONS
463 #pragma region PATTERN_INFO_FUNCTIONS
468 #pragma region SUBSTRING_FUNCTIONS
471 pcre2_substring_number_from_name_8;
478 #pragma region UTF_16
480 #if _PCRE2CPP_HAS_UTF16
503 #pragma region PCRE2_STRING
510 #pragma region CPP_STRING
519 #pragma region UTF_INFO
526 #pragma region CODE_FUNCTIONS
534 #pragma region MATCH_DATA_FUNCTIONS
542 #pragma region MATCH_FUNCTIONS
549 #pragma region OVECTOR_FUNCTIONS
556 #pragma region ERROR_FUNCTIONS
561 #pragma region PATTERN_INFO_FUNCTIONS
566 #pragma region SUBSTRING_FUNCTIONS
569 pcre2_substring_number_from_name_16;
576 #pragma region UTF_32
578 #if _PCRE2CPP_HAS_UTF32
601 #pragma region PCRE2_STRING
608 #pragma region CPP_STRING
617 #pragma region UTF_INFO
624 #pragma region CODE_FUNCTIONS
632 #pragma region MATCH_DATA_FUNCTIONS
640 #pragma region MATCH_FUNCTIONS
647 #pragma region OVECTOR_FUNCTIONS
654 #pragma region ERROR_FUNCTIONS
659 #pragma region PATTERN_INFO_FUNCTIONS
664 #pragma region SUBSTRING_FUNCTIONS
667 pcre2_substring_number_from_name_32;
674 #if _PCRE2CPP_HAS_UTF8
677 #if _PCRE2CPP_HAS_UTF16
680 #if _PCRE2CPP_HAS_UTF32
688#pragma region exceptions_exceptions.hpp
689#ifndef _PCRE2CPP_EXCEPTIONS_HPP_
690 #define _PCRE2CPP_EXCEPTIONS_HPP_
694 #if !_PCRE2CPP_HAS_CXX17
700 #if _PCRE2CPP_HAS_ASSERTS
712 template<utf_type utf>
716 using _pcre2_data_t = utils::pcre2_data<utf>;
717 using _string_type =
typename _pcre2_data_t::string_type;
718 using _uchar_type =
typename _pcre2_data_t::uchar_type;
719 using _char_type =
typename _pcre2_data_t::string_char_type;
721 _uchar_type error_message[120];
722 if (
const int size = _pcre2_data_t::get_error_message(error_code, error_message, 120); size != PCRE2_ERROR_BADDATA) {
723 return _string_type(
reinterpret_cast<_char_type*
>(error_message), 120);
725 return _string_type();
736 template<utf_type utf>
738 const size_t error_offset)
noexcept {
741 #if _PCRE2CPP_HAS_UTF8
743 return fmt::format(
"error at {} {}", error_offset, pcre2cpp::generate_error_message<utf>(error_code));
747 #if _PCRE2CPP_HAS_UTF16
749 return fmt::format(u
"error at {} {}", error_offset, pcre2cpp::generate_error_message<utf>(error_code));
753 #if _PCRE2CPP_HAS_UTF32
755 return fmt::format(U
"error at {} {}", error_offset, pcre2cpp::generate_error_message<utf>(error_code));
760 return _string_type();
771 template<utf_type utf>
773 #if _PCRE2CPP_HAS_UTF8
777 #if _PCRE2CPP_HAS_UTF16
780 for (
const auto& c : message) { msg +=
static_cast<std::string::value_type
>(c); }
785 #if _PCRE2CPP_HAS_UTF32
788 for (
const auto& c : message) { msg +=
static_cast<std::string::value_type
>(c); }
794 return std::string();
798 #if _PCRE2CPP_HAS_EXCEPTIONS
799 #pragma region PCRE2CPP_EXCEPTION
806 template<utf_type utf>
807 class basic_pcre2cpp_exception :
public std::runtime_error {
809 using _pcre2_data_t = utils::pcre2_data<utf>;
810 using _string_type =
typename _pcre2_data_t::string_type;
811 using _string_view_type =
typename _pcre2_data_t::string_view_type;
812 using _uchar_type =
typename _pcre2_data_t::uchar_type;
813 using _char_type =
typename _pcre2_data_t::string_char_type;
816 _string_type _message;
820 explicit basic_pcre2cpp_exception(
const _string_view_type message) noexcept
821 : std::runtime_error(convert_any_utf_to_utf8<utf>(message)), _message(message) {}
824 explicit basic_pcre2cpp_exception(
const int error_code) noexcept
825 : std::runtime_error(convert_any_utf_to_utf8<utf>(generate_error_message<utf>(error_code))),
826 _message(generate_error_message<utf>(error_code)) {}
829 basic_pcre2cpp_exception(
const int error_code,
const size_t error_offset) noexcept
830 : std::runtime_error(convert_any_utf_to_utf8<utf>(generate_error_message<utf>(error_code, error_offset))),
831 _message(generate_error_message<utf>(error_code, error_offset)) {}
837 #if _PCRE2CPP_HAS_UTF8
838 using u8pcre2cpp_exception = basic_pcre2cpp_exception<utf_type::UTF_8>;
840 #if _PCRE2CPP_HAS_UTF16
841 using u16pcre2cpp_exception = basic_pcre2cpp_exception<utf_type::UTF_16>;
843 #if _PCRE2CPP_HAS_UTF32
844 using u32pcre2cpp_exception = basic_pcre2cpp_exception<utf_type::UTF_32>;
847 #if _PCRE2CPP_HAS_UTF8
848 using pcre2cpp_exception = u8pcre2cpp_exception;
849 #elif _PCRE2CPP_HAS_UTF16
850 using pcre2cpp_exception = u16pcre2cpp_exception;
851 #elif _PCRE2CPP_HAS_UTF32
852 using pcre2cpp_exception = u32pcre2cpp_exception;
855 #pragma endregion PCRE2CPP_EXCEPTION
857 #pragma region REGEX_EXCEPTION
864 template<utf_type utf>
865 class basic_regex_exception :
public basic_pcre2cpp_exception<utf> {
867 using _string_view_type =
typename utils::pcre2_data<utf>::string_view_type;
871 explicit basic_regex_exception(
const _string_view_type message) noexcept : basic_pcre2cpp_exception<utf>(message) {}
874 basic_regex_exception(
const int error_code,
const size_t error_offset) noexcept
875 : basic_pcre2cpp_exception<utf>(error_code, error_offset) {}
877 using basic_pcre2cpp_exception<utf>::get_error;
880 #if _PCRE2CPP_HAS_UTF8
881 using u8regex_exception = basic_regex_exception<utf_type::UTF_8>;
883 #if _PCRE2CPP_HAS_UTF16
884 using u16regex_exception = basic_regex_exception<utf_type::UTF_16>;
886 #if _PCRE2CPP_HAS_UTF32
887 using u32regex_exception = basic_regex_exception<utf_type::UTF_32>;
890 #if _PCRE2CPP_HAS_UTF8
891 using regex_exception = u8regex_exception;
892 #elif _PCRE2CPP_HAS_UTF16
893 using regex_exception = u16regex_exception;
894 #elif _PCRE2CPP_HAS_UTF32
895 using regex_exception = u32regex_exception;
898 #pragma endregion REGEX_EXCEPTION
900 #pragma region MATCH_RESULT_EXCEPTION
907 template<utf_type utf>
908 class basic_match_result_exception :
public basic_pcre2cpp_exception<utf> {
910 using _string_view_type =
typename utils::pcre2_data<utf>::string_view_type;
914 explicit basic_match_result_exception(
const _string_view_type message) noexcept
915 : basic_pcre2cpp_exception<utf>(message) {}
918 explicit basic_match_result_exception(
const int error_code) noexcept : basic_pcre2cpp_exception<utf>(error_code) {}
920 using basic_pcre2cpp_exception<utf>::get_error;
923 #if _PCRE2CPP_HAS_UTF8
924 using u8match_result_exception = basic_match_result_exception<utf_type::UTF_8>;
926 #if _PCRE2CPP_HAS_UTF16
927 using u16match_result_exception = basic_match_result_exception<utf_type::UTF_16>;
929 #if _PCRE2CPP_HAS_UTF32
930 using u32match_result_exception = basic_match_result_exception<utf_type::UTF_32>;
933 #if _PCRE2CPP_HAS_UTF8
934 using match_result_exception = u8match_result_exception;
935 #elif _PCRE2CPP_HAS_UTF16
936 using match_result_exception = u16match_result_exception;
937 #elif _PCRE2CPP_HAS_UTF32
938 using match_result_exception = u32match_result_exception;
941 #pragma endregion MATCH_RESULT_EXCEPTION
948#pragma region match_match_options.hpp
949#ifndef _PCRE2CPP_REGEX_MATCH_OPTIONS_HPP_
950 #define _PCRE2CPP_REGEX_MATCH_OPTIONS_HPP_
954 #if !_PCRE2CPP_HAS_CXX17
1008 return mstd::operator|(opt0, opt1);
1015#pragma region match_match_result.hpp
1016#ifndef _PCRE2CPP_MATCH_RESULT_HPP_
1017 #define _PCRE2CPP_MATCH_RESULT_HPP_
1021 #if !_PCRE2CPP_HAS_CXX17
1031 #pragma region MATCH_VALUE
1038 template<utf_type utf>
1050 #if _PCRE2CPP_HAS_UTF8
1053 #if _PCRE2CPP_HAS_UTF16
1056 #if _PCRE2CPP_HAS_UTF32
1060 #if _PCRE2CPP_HAS_UTF8
1062 #elif _PCRE2CPP_HAS_UTF16
1064 #elif _PCRE2CPP_HAS_UTF32
1069 #pragma region SUB_MATCH_VALUE
1089 template<utf_type utf>
1097 using _string_type =
typename _pcre2_data_t::string_type;
1098 using _string_view_type =
typename _pcre2_data_t::string_view_type;
1100 #if _PCRE2CPP_HAS_EXCEPTIONS
1101 using _match_result_exception = basic_match_result_exception<utf>;
1103 using _named_sub_values_table = std::unordered_map<_string_type, size_t>;
1104 using _named_sub_values_table_ptr = std::shared_ptr<_named_sub_values_table>;
1107 struct _value_result_data {
1109 _match_value result = {
bad_offset, _string_type() };
1110 std::vector<std::optional<sub_match_value> > sub_results = {};
1111 _named_sub_values_table_ptr named_sub_values = {};
1116 std::variant<match_error_codes, _value_result_data> _data = _value_result_data();
1120 #if _PCRE2CPP_HAS_UTF8
1124 #if _PCRE2CPP_HAS_UTF16
1126 return u
"Subexpression index out of bounds or has no value";
1130 #if _PCRE2CPP_HAS_UTF32
1132 return U
"Subexpression index out of bounds or has no value";
1137 return _string_type();
1142 static _PCRE2CPP_CONSTEXPR17 _string_type _get_subexpression_not_found(
const _string_view_type name)
noexcept {
1143 #if _PCRE2CPP_HAS_UTF8
1145 return fmt::format(
"Subexpression with provided name '{}' not found", name);
1149 #if _PCRE2CPP_HAS_UTF16
1151 return fmt::format(u
"Subexpression with provided name '{}' not found", name);
1155 #if _PCRE2CPP_HAS_UTF32
1157 return fmt::format(U
"Subexpression with provided name '{}' not found", name);
1162 return _string_type();
1168 const auto& named_sub_values = std::get<_value_result_data>(_data).named_sub_values;
1169 #if _PCRE2CPP_HAS_CXX20
1170 return named_sub_values->contains(name.data());
1172 return named_sub_values->find(name.data()) != named_sub_values->end();
1178 const auto& subResults = std::get<_value_result_data>(_data).sub_results;
1179 return idx < subResults.size() && subResults[idx].has_value();
1184 if (!_has_named_sub_result(name)) {
1185 #if _PCRE2CPP_HAS_EXCEPTIONS
1186 throw _match_result_exception(_get_subexpression_not_found(name));
1192 return std::get<_value_result_data>(_data).named_sub_values->at(name.data());
1197 if (!_has_sub_value(idx)) {
1198 #if _PCRE2CPP_HAS_EXCEPTIONS
1199 throw basic_match_result_exception<utf>(_get_out_of_bounds_string());
1202 return { .relative_offset =
bad_offset, .size = 0 };
1206 return std::get<_value_result_data>(_data).sub_results[idx].value();
1210 #pragma region CONSTRUCTORS
1219 const _named_sub_values_table_ptr& named_sub_values) noexcept
1220 : _data(_value_result_data { .search_offset = search_offset, .named_sub_values = named_sub_values }) {}
1224 const std::vector<std::optional<sub_match_value> >& sub_results,
1225 const _named_sub_values_table_ptr& named_sub_values) noexcept
1226 : _data(_value_result_data { .search_offset = search_offset,
1228 .sub_results = sub_results,
1229 .named_sub_values = named_sub_values,
1246 #pragma region ERRORS
1253 if (!
has_error()) {
return match_error_codes::None; }
1254 return std::get<match_error_codes>(_data);
1259 if (!
has_error()) {
return _string_type(); }
1260 return pcre2cpp::generate_error_message<utf>(
static_cast<int>(std::get<match_error_codes>(_data)));
1263 #if _PCRE2CPP_HAS_EXCEPTIONS
1267 throw _match_result_exception(
static_cast<int>(std::get<match_error_codes>(_data)));
1271 #pragma endregion ERRORS
1273 #pragma region RESULTS
1281 return std::get<_value_result_data>(_data).found;
1287 return _has_sub_value(idx);
1292 return _has_named_sub_result(name) &&
has_sub_value(_get_named_sub_result_idx(name));
1298 return std::get<_value_result_data>(_data).search_offset;
1301 #pragma region RESULT
1306 return std::get<_value_result_data>(_data).result;
1312 const auto& value = std::get<_value_result_data>(_data);
1313 return value.search_offset + value.result.relative_offset;
1319 return std::get<_value_result_data>(_data).result.relative_offset;
1325 return std::get<_value_result_data>(_data).result.value.size();
1330 if (!
has_value()) {
return _string_type(); }
1331 return std::get<_value_result_data>(_data).result.value;
1334 #pragma endregion RESULT
1336 #pragma region ALL_SUB_RESULTS
1341 return std::get<_value_result_data>(_data).sub_results;
1351 const auto& value = std::get<_value_result_data>(_data);
1353 std::vector<size_t> offsets;
1354 offsets.reserve(value.sub_results.size());
1355 for (
const auto& subResult : value.sub_results) {
1356 if (subResult.has_value()) {
1357 offsets.push_back(value.search_offset + value.result.relative_offset + subResult->relative_offset);
1368 const auto& value = std::get<_value_result_data>(_data);
1370 std::vector<size_t> offsets;
1371 offsets.reserve(value.sub_results.size());
1372 for (
const auto& subResult : value.sub_results) {
1373 if (subResult.has_value()) {
1374 offsets.push_back(value.result.relative_offset + subResult->relative_offset);
1385 const auto& sub_results = std::get<_value_result_data>(_data).sub_results;
1387 std::vector<size_t> offsets;
1388 offsets.reserve(sub_results.size());
1389 for (
const auto& subResult : sub_results) {
1390 if (subResult.has_value()) { offsets.push_back(subResult->relative_offset); }
1400 const auto& sub_results = std::get<_value_result_data>(_data).sub_results;
1402 std::vector<size_t> values;
1403 values.reserve(sub_results.size());
1404 for (
const auto& subResult : sub_results) {
1405 if (subResult.has_value()) { values.emplace_back(subResult->size); }
1406 else { values.push_back(0); }
1415 const auto& data = std::get<_value_result_data>(_data);
1416 const auto& value = data.result.value;
1417 const auto& sub_results = data.sub_results;
1419 std::vector<_string_type> values;
1420 values.reserve(sub_results.size());
1421 for (
const auto& subResult : sub_results) {
1422 if (subResult.has_value()) {
1423 values.emplace_back(value.data() + subResult->relative_offset, subResult->size);
1425 else { values.push_back(_string_type()); }
1430 #pragma endregion ALL_SUB_RESULTS
1432 #pragma region SUB_RESULTS_BY_IDX
1436 return _get_sub_value(idx);
1443 const auto [relative_offset, size] = _get_sub_value(idx);
1444 const auto& value = std::get<_value_result_data>(_data);
1445 return value.search_offset + value.result.relative_offset + relative_offset;
1452 const auto [relative_offset, size] = _get_sub_value(idx);
1453 const auto& value = std::get<_value_result_data>(_data);
1454 return value.result.relative_offset + relative_offset;
1460 return _get_sub_value(idx).relative_offset;
1466 return _get_sub_value(idx).size;
1473 const auto [relative_offset, size] = _get_sub_value(idx);
1474 const auto& value = std::get<_value_result_data>(_data).result.value;
1475 return _string_type(value.data() + relative_offset, size);
1480 #pragma region SUB_RESULTS_BY_NAME
1514 #pragma endregion RESULTS
1517 #if _PCRE2CPP_HAS_UTF8
1520 #if _PCRE2CPP_HAS_UTF16
1523 #if _PCRE2CPP_HAS_UTF32
1527 #if _PCRE2CPP_HAS_UTF8
1529 #elif _PCRE2CPP_HAS_UTF16
1531 #elif _PCRE2CPP_HAS_UTF32
1539#pragma region regex_compile_options.hpp
1540#ifndef _PCRE2CPP_COMPILE_OPTIONS_HPP_
1541 #define _PCRE2CPP_COMPILE_OPTIONS_HPP_
1545 #if !_PCRE2CPP_HAS_CXX17
1633 return mstd::operator|(opt0, opt1);
1640#pragma region regex_regex.hpp
1641#ifndef _PCRE2CPP_REGEX_HPP_
1642 #define _PCRE2CPP_REGEX_HPP_
1646 #if !_PCRE2CPP_HAS_CXX17
1664 template<utf_type utf>
1669 using _code_type =
typename _pcre2_data_t::code_type;
1670 using _code_ptr = std::shared_ptr<_code_type>;
1671 using _match_data_type =
typename _pcre2_data_t::match_data_type;
1672 using _match_data_ptr = std::shared_ptr<_match_data_type>;
1673 using _string_type =
typename _pcre2_data_t::string_type;
1674 using _string_view_type =
typename _pcre2_data_t::string_view_type;
1675 using _string_char_type =
typename _pcre2_data_t::string_char_type;
1678 using _sptr_type =
typename _pcre2_data_t::sptr_type;
1679 using _named_sub_values_table = std::unordered_map<_string_type, size_t>;
1680 using _named_sub_values_table_ptr = std::shared_ptr<_named_sub_values_table>;
1681 using _uchar_type =
typename _pcre2_data_t::uchar_type;
1682 #if _PCRE2CPP_HAS_EXCEPTIONS
1683 using _regex_exception = basic_regex_exception<utf>;
1687 _code_ptr _code =
nullptr;
1689 _match_data_ptr _match_data =
nullptr;
1691 _named_sub_values_table_ptr _named_sub_values =
nullptr;
1694 int _error_code = 0;
1696 size_t _error_offset = 0;
1699 #if _PCRE2CPP_HAS_UTF8
1703 #if _PCRE2CPP_HAS_UTF16
1705 return u
"Regex was not initialized!!";
1709 #if _PCRE2CPP_HAS_UTF32
1711 return U
"Regex was not initialized!!";
1716 return _string_type();
1725 _code_type* code = _pcre2_data_t::compile(
reinterpret_cast<_sptr_type
>(pattern.data()), pattern.size(), opts,
1726 &_error_code, &_error_offset,
nullptr);
1728 if (code ==
nullptr) {
1729 #if !_PCRE2CPP_HAS_EXCEPTIONS
1730 std::string message = fmt::format(
"Failed to initialize code: {}",
1731 convert_any_utf_to_utf8<utf>(generate_error_message<utf>(_error_code, _error_offset)));
1735 throw _regex_exception(_error_code, _error_offset);
1739 _code = std::shared_ptr<_code_type>(code, _pcre2_data_t::code_free);
1742 _named_sub_values = std::make_shared<_named_sub_values_table>();
1744 size_t name_count = 0;
1745 _uchar_type* name_table =
nullptr;
1746 size_t name_entry_size = 0;
1748 _pcre2_data_t::get_info(_code.get(), PCRE2_INFO_NAMECOUNT, &name_count);
1749 _pcre2_data_t::get_info(_code.get(), PCRE2_INFO_NAMETABLE, &name_table);
1750 _pcre2_data_t::get_info(_code.get(), PCRE2_INFO_NAMEENTRYSIZE, &name_entry_size);
1752 for (
size_t i = 0; i != name_count; ++i) {
1753 _uchar_type* entry = name_table + i * name_entry_size + 2;
1754 const int index = _pcre2_data_t::substring_number_from_name(_code.get(), entry);
1756 _uchar_type* entry_end = entry + 1;
1757 while (*entry_end != 0 && entry_end - entry < name_entry_size - 3) { entry_end += 1; }
1758 _named_sub_values->emplace(_string_type(entry, entry_end),
static_cast<size_t>(index) - 1);
1762 _match_data_type* match_data = _pcre2_data_t::match_data_from_pattern(_code.get(),
nullptr);
1763 _match_data = std::shared_ptr<_match_data_type>(match_data, _pcre2_data_t::match_data_free);
1779 #pragma region CHECK_INITIALIZATION
1784 #pragma endregion CHECK_INITIALIZATION
1786 #pragma region ERROR
1791 #if _PCRE2CPP_HAS_UTF8
1795 #if _PCRE2CPP_HAS_UTF16
1801 #if _PCRE2CPP_HAS_UTF32
1808 return _string_type();
1811 return pcre2cpp::generate_error_message<utf>(_error_code, _error_offset);
1814 #pragma endregion ERROR
1820 #if !_PCRE2CPP_HAS_EXCEPTIONS
1824 throw _regex_exception(_get_regex_not_initialized_error());
1828 const int match_code = _pcre2_data_t::match(_code.get(),
reinterpret_cast<_sptr_type
>(text.data()), text.size(),
1829 offset, opts, _match_data.get(),
nullptr);
1831 return match_code !=
static_cast<int>(match_error_codes::NoMatch) && match_code > 0;
1838 #if !_PCRE2CPP_HAS_EXCEPTIONS
1842 throw _regex_exception(_get_regex_not_initialized_error());
1846 const int match_code = _pcre2_data_t::match(_code.get(),
reinterpret_cast<_sptr_type
>(text.data()), text.size(),
1847 offset, opts, _match_data.get(),
nullptr);
1849 if (match_code ==
static_cast<int>(match_error_codes::NoMatch) || match_code <= 0) {
1850 result = _match_result_type(
static_cast<match_error_codes
>(match_code));
1854 const size_t* offsetVector = _pcre2_data_t::get_ovector_ptr(_match_data.get());
1855 const size_t matchStart = offsetVector[0];
1856 const size_t matchEnd = offsetVector[1];
1857 _match_value_type value = { .relative_offset = matchStart - offset,
1858 .value = _string_type(text.substr(matchStart, matchEnd - matchStart)) };
1860 const size_t offsetVectorsCount = _pcre2_data_t::get_ovector_count(_match_data.get());
1861 std::vector<std::optional<sub_match_value> > sub_values;
1862 sub_values.reserve(offsetVectorsCount);
1863 for (
size_t i = 1; i != offsetVectorsCount; ++i) {
1864 const size_t subMatchStart = offsetVector[i * 2];
1865 const size_t subMatchEnd = offsetVector[i * 2 + 1];
1867 if (subMatchStart == PCRE2_UNSET || subMatchEnd == PCRE2_UNSET) { sub_values.emplace_back(); }
1869 sub_values.push_back(
sub_match_value { .relative_offset = subMatchStart - matchStart,
1870 .size = subMatchEnd - subMatchStart });
1874 result = _match_result_type(offset, value, sub_values, _named_sub_values);
1880 _match_result_type result;
1881 return match_at(text, result, offset);
1886 const size_t offset = 0) const noexcept {
1887 if (!
match(text, result, offset)) {
return false; }
1890 result = _match_result_type(offset, _named_sub_values);
1899 size_t offset = 0) const noexcept {
1900 size_t start_offset = offset;
1901 _match_result_type result;
1902 while (
match(text, result, offset)) {
1903 results.emplace_back(start_offset,
1910 return results.size() != 0;
1914 #if _PCRE2CPP_HAS_UTF8
1917 #if _PCRE2CPP_HAS_UTF16
1920 #if _PCRE2CPP_HAS_UTF32
1924 #if _PCRE2CPP_HAS_UTF8
1926 #elif _PCRE2CPP_HAS_UTF16
1928 #elif _PCRE2CPP_HAS_UTF32
1936#pragma region utils_assert.hpp
1937#ifndef _PCRE2CPP_ASSERT_HPP_
1938 #define _PCRE2CPP_ASSERT_HPP_
1942 #if !_PCRE2CPP_HAS_ASSERTS
1943_PCRE2CPP_ERROR(
"This is only available for c++17 and greater and when asserts are enabled!");
1954 #define pcre2cpp_assert(expression, ...) \
1955 MSTD_STOP_ASSERT_BASE(expression, [](const std::string_view) -> void {} __VA_OPT__(, ) __VA_ARGS__)
1956 #elif !defined(PCRE2CPP_DISABLE_ASSERT_ON_RELEASE)
1957 #define pcre2cpp_assert(expression, ...) \
1958 MSTD_LOG_ASSERT_BASE(expression, [](const std::string_view) -> void {} __VA_OPT__(, ) __VA_ARGS__)
1960 #define pcre2cpp_assert(expression, ...) \
1961 MSTD_EMPTY_ASSERT_BASE(expression, [](const std::string_view) -> void {} __VA_OPT__(, ) __VA_ARGS__)
1968#pragma region pcre2cpp.hpp
1969#ifndef _PCRE2CPP_PCRE2CPP_HPP_
1970 #define _PCRE2CPP_PCRE2CPP_HPP_
1973 #if !_PCRE2CPP_HAS_CXX17
1980 #if _PCRE2CPP_HAS_ASSERTS
Basic container to result data of match function.
Definition pcre2cpp.hpp:1090
_PCRE2CPP_CONSTEXPR17 basic_match_result(const size_t search_offset, const _named_sub_values_table_ptr &named_sub_values) noexcept
constructor with no value but also without error
Definition pcre2cpp.hpp:1218
_PCRE2CPP_CONSTEXPR17 bool has_result() const noexcept
returns true when result holds some result not error
Definition pcre2cpp.hpp:1276
_PCRE2CPP_CONSTEXPR17 match_error_codes get_error_code() const noexcept
return error code
Definition pcre2cpp.hpp:1252
_PCRE2CPP_CONSTEXPR17 basic_match_result(basic_match_result &&other) noexcept=default
default move constructor
_PCRE2CPP_CONSTEXPR17 bool has_sub_value(const _string_view_type name) const noexcept
returns true when result has sub value with given name
Definition pcre2cpp.hpp:1291
_PCRE2CPP_CONSTEXPR17 size_t get_search_offset() const noexcept
returns search offset
Definition pcre2cpp.hpp:1296
_PCRE2CPP_CONSTEXPR17 size_t get_sub_results_count() const noexcept
returns sub results count
Definition pcre2cpp.hpp:1345
_PCRE2CPP_CONSTEXPR17 sub_match_value get_sub_result(const _string_view_type name) const _PCRE2CPP_NOEXCEPT
returns sub result container
Definition pcre2cpp.hpp:1483
_PCRE2CPP_CONSTEXPR17 basic_match_result() noexcept=default
default constructor
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_relative_offset(const _string_view_type name) const _PCRE2CPP_NOEXCEPT
returns sub result offset relative to search offset
Definition pcre2cpp.hpp:1493
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_global_offset(const _string_view_type name) const _PCRE2CPP_NOEXCEPT
returns sub result offset from the beginning of searched string
Definition pcre2cpp.hpp:1488
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_global_offset(const size_t idx) const _PCRE2CPP_NOEXCEPT
returns sub result offset from the beginning of searched string
Definition pcre2cpp.hpp:1440
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_size(const size_t idx) const _PCRE2CPP_NOEXCEPT
returns sub result value size
Definition pcre2cpp.hpp:1464
_PCRE2CPP_CONSTEXPR17 std::vector< _string_type > get_sub_results_values() const noexcept
returns sub results string values
Definition pcre2cpp.hpp:1412
_PCRE2CPP_CONSTEXPR17 basic_match_result(const basic_match_result &other) noexcept=default
default copy constructor
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > get_sub_results_sizes() const noexcept
returns sub results value sizes
Definition pcre2cpp.hpp:1397
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_in_result_offset(const _string_view_type name) const _PCRE2CPP_NOEXCEPT
returns sub result offset relative to result offset
Definition pcre2cpp.hpp:1498
_PCRE2CPP_CONSTEXPR17 sub_match_value get_sub_result(const size_t idx) const _PCRE2CPP_NOEXCEPT
returns sub result container
Definition pcre2cpp.hpp:1435
static _PCRE2CPP_CONSTEXPR17 size_t bad_offset
Definition pcre2cpp.hpp:1093
_PCRE2CPP_CONSTEXPR17 _string_type get_error_message() const noexcept
returns error message
Definition pcre2cpp.hpp:1258
_PCRE2CPP_CONSTEXPR17 _match_value get_result() const noexcept
returns match result container
Definition pcre2cpp.hpp:1304
_PCRE2CPP_CONSTEXPR17 size_t get_result_global_offset() const noexcept
returns offset of value from the beginning of searched string
Definition pcre2cpp.hpp:1310
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_in_result_offset(const size_t idx) const _PCRE2CPP_NOEXCEPT
returns sub result offset relative to result offset
Definition pcre2cpp.hpp:1458
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > get_sub_results_in_result_offsets() const noexcept
returns sub results offsets relative to result offset
Definition pcre2cpp.hpp:1382
_PCRE2CPP_CONSTEXPR20 std::vector< std::optional< sub_match_value > > get_sub_results() const noexcept
returns all sub results
Definition pcre2cpp.hpp:1339
_PCRE2CPP_CONSTEXPR17 bool has_error() const noexcept
returns true if result holds error
Definition pcre2cpp.hpp:1249
_PCRE2CPP_CONSTEXPR17 basic_match_result(const size_t search_offset, const _match_value &result, const std::vector< std::optional< sub_match_value > > &sub_results, const _named_sub_values_table_ptr &named_sub_values) noexcept
constructor with good result
Definition pcre2cpp.hpp:1223
_PCRE2CPP_CONSTEXPR17 _string_type get_result_value() const noexcept
returns match string value
Definition pcre2cpp.hpp:1329
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > get_sub_results_global_offsets() const noexcept
returns sub results offsets from the beginning of search string
Definition pcre2cpp.hpp:1348
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_relative_offset(const size_t idx) const _PCRE2CPP_NOEXCEPT
returns sub result offset relative to search offset
Definition pcre2cpp.hpp:1449
_PCRE2CPP_CONSTEXPR17 size_t get_result_size() const noexcept
returns size of match value
Definition pcre2cpp.hpp:1323
_PCRE2CPP_CONSTEXPR20 std::vector< size_t > get_sub_results_relative_offsets() const noexcept
returns sub results offsets relative to search offset
Definition pcre2cpp.hpp:1365
_PCRE2CPP_CONSTEXPR17 size_t get_result_relative_offset() const noexcept
return offset relative to search offset
Definition pcre2cpp.hpp:1317
_PCRE2CPP_CONSTEXPR17 _string_type get_sub_result_value(const _string_view_type name) const _PCRE2CPP_NOEXCEPT
returns sub result string value
Definition pcre2cpp.hpp:1508
_PCRE2CPP_CONSTEXPR20 ~basic_match_result() noexcept=default
default destructor
_PCRE2CPP_CONSTEXPR17 bool has_value() const noexcept
returns true when result has value
Definition pcre2cpp.hpp:1279
_PCRE2CPP_CONSTEXPR17 bool has_sub_value(const size_t idx) const noexcept
returns true when result has sub value on given index
Definition pcre2cpp.hpp:1285
_PCRE2CPP_CONSTEXPR17 size_t get_sub_result_size(const _string_view_type name) const _PCRE2CPP_NOEXCEPT
returns sub result value size
Definition pcre2cpp.hpp:1503
_PCRE2CPP_CONSTEXPR17 _string_type get_sub_result_value(const size_t idx) const _PCRE2CPP_NOEXCEPT
returns sub result string value
Definition pcre2cpp.hpp:1470
Basic PCRE2 Regex container.
Definition pcre2cpp.hpp:1665
_PCRE2CPP_CONSTEXPR17 basic_regex(const basic_regex &other) noexcept=default
default copy constructor
_PCRE2CPP_CONSTEXPR20 bool match(const _string_view_type text, _match_result_type &result, const size_t offset=0, const match_options opts=match_options_bits::None) const noexcept
returns true if match was found and result is stored in result variable
Definition pcre2cpp.hpp:1835
_PCRE2CPP_CONSTEXPR17 bool match_all(const _string_view_type text, std::vector< _match_result_type > &results, size_t offset=0) const noexcept
returns true if any match was found and all results store in results array
Definition pcre2cpp.hpp:1898
_PCRE2CPP_CONSTEXPR20 basic_regex(const _string_view_type pattern, const compile_options opts=compile_options_bits::None) _PCRE2CPP_NOEXCEPT
basic regex container with pattern and compile options
Definition pcre2cpp.hpp:1722
_PCRE2CPP_CONSTEXPR17 bool match(const _string_view_type text, const size_t offset=0, const match_options opts=match_options_bits::None) const _PCRE2CPP_NOEXCEPT
returns true if match was found
Definition pcre2cpp.hpp:1817
_PCRE2CPP_CONSTEXPR17 bool is_initialized() const noexcept
returns true if regex was initialized
Definition pcre2cpp.hpp:1782
_PCRE2CPP_CONSTEXPR17 _string_type get_error_message() const noexcept
returns error message if there is any compilation error
Definition pcre2cpp.hpp:1789
_PCRE2CPP_CONSTEXPR17 bool match_at(const _string_view_type text, _match_result_type &result, const size_t offset=0) const noexcept
returns true if match was found, and it has relative offset == 0 and result is stored in result varia...
Definition pcre2cpp.hpp:1885
_PCRE2CPP_CONSTEXPR17 basic_regex(basic_regex &&other) noexcept=default
default move constructor
_PCRE2CPP_CONSTEXPR20 ~basic_regex() noexcept=default
default destructor
_PCRE2CPP_CONSTEXPR17 bool match_at(const _string_view_type text, const size_t offset=0) const noexcept
returns true if match was found, and it has relative offset == 0
Definition pcre2cpp.hpp:1879
#define _PCRE2CPP_NOEXCEPT
Definition config.hpp:178
utf_type
Enum with supported utf types.
Definition pcre2cpp.hpp:352
compile_options_bits
Compile options.
Definition pcre2cpp.hpp:1556
match_options_bits
Match options.
Definition pcre2cpp.hpp:965
mstd::flags< match_options_bits > match_options
Match options flags group.
Definition pcre2cpp.hpp:998
mstd::flags< compile_options_bits > compile_options
Compile options flags group.
Definition pcre2cpp.hpp:1623
@ UTF_16
Definition pcre2cpp.hpp:357
@ UTF_32
Definition pcre2cpp.hpp:360
@ UTF_8
Definition pcre2cpp.hpp:354
@ NoAutoPossess
Disable auto - possessification.
Definition pcre2cpp.hpp:1602
@ MatchUnsetBackRef
Match unset backreferences.
Definition pcre2cpp.hpp:1590
@ DollarEndonly
$ not to match newline at end
Definition pcre2cpp.hpp:1574
@ Caseless
Do caseless matching.
Definition pcre2cpp.hpp:1572
@ AllowEmptyClass
Allow empty classes.
Definition pcre2cpp.hpp:1562
@ DotAll
. matches anything including NL
Definition pcre2cpp.hpp:1576
@ NoDotStarAnchor
Disable automatic anchoring for .*.
Definition pcre2cpp.hpp:1604
@ NeverUCP
Lock out PCRE2_UCP, e.g.via(*UCP).
Definition pcre2cpp.hpp:1596
@ AutoCallout
Compile automatic callouts.
Definition pcre2cpp.hpp:1570
@ AltVerbNames
Process backslashes in verb names.
Definition pcre2cpp.hpp:1568
@ AltCircumflex
Alternative handling of ^ in multiline mode.
Definition pcre2cpp.hpp:1566
@ NoStartOptimize
Disable match - time start optimizations.
Definition pcre2cpp.hpp:1606
@ None
No options set (default).
Definition pcre2cpp.hpp:1558
@ Multiline
^ and $ match newlines within data
Definition pcre2cpp.hpp:1592
@ UnGreedy
Invert greediness of quantifiers.
Definition pcre2cpp.hpp:1612
@ UTF
Treat pattern and subjects as UTF strings.
Definition pcre2cpp.hpp:1616
@ NoAutoCapture
Disable numbered capturing paren - theses(named ones available).
Definition pcre2cpp.hpp:1600
@ UseOffsetLimit
Enable offset limit for unanchored matching.
Definition pcre2cpp.hpp:1614
@ MatchInvalidUTF
Enable support for matching invalid UTF.
Definition pcre2cpp.hpp:1588
@ AltBSUX
Alternative handling of \u, \U, and \x.
Definition pcre2cpp.hpp:1564
@ NeverUTF
Lock out PCRE2_UTF, e.g.via(*UTF).
Definition pcre2cpp.hpp:1598
@ FirstLine
Force matching to be before newline.
Definition pcre2cpp.hpp:1584
@ DupNames
Allow duplicate names for subpatterns.
Definition pcre2cpp.hpp:1578
@ Literal
Pattern characters are all literal.
Definition pcre2cpp.hpp:1586
@ NeverBackslashC
Lock out the use of \C in patterns.
Definition pcre2cpp.hpp:1594
@ Extended
Ignore white space and # comments.
Definition pcre2cpp.hpp:1582
@ UCP
Use Unicode properties for \d, \w, etc.
Definition pcre2cpp.hpp:1610
@ NotEOL
Subject string is not the end of a line.
Definition pcre2cpp.hpp:979
@ PartialHard
Return match_error_codes::Partial for a partial match even if there is a full match.
Definition pcre2cpp.hpp:989
@ NotBOL
Subject string is not the beginning of a line.
Definition pcre2cpp.hpp:977
@ NotEmpty
An empty string is not a valid match.
Definition pcre2cpp.hpp:981
@ PartialSoft
Return match_error_codes::Partial for a partial match if no full matches are found.
Definition pcre2cpp.hpp:991
@ None
No options set (default).
Definition pcre2cpp.hpp:967
@ CopyMatchedSubject
On success, make a private subject copy.
Definition pcre2cpp.hpp:971
@ NoUTFCheck
Do not check the subject for UTF validity(only relevant if compile_options::UTF was set at compile ti...
Definition pcre2cpp.hpp:987
@ Anchored
Match only at the first position.
Definition pcre2cpp.hpp:969
@ NotEmptyAtStart
An empty string at the start of the subject is not a valid match.
Definition pcre2cpp.hpp:983
@ EndAnchored
Pattern can match only at end of subject.
Definition pcre2cpp.hpp:975
@ DisableRecurseLoopCheck
Only useful in rare cases; use with care.
Definition pcre2cpp.hpp:973
@ NoJIT
Do not use JIT matching.
Definition pcre2cpp.hpp:985
#define _PCRE2CPP_CONSTEXPR17
constexpr for c++17 and higher
Definition config.hpp:239
#define _PCRE2CPP_CONSTEXPR20
constexpr keyword for c++20 and higher
Definition config.hpp:257
#define _PCRE2CPP_ERROR(MESSAGE)
compiler error
Definition config.hpp:278
#define pcre2cpp_assert(expression,...)
pcre2cpp assert
Definition pcre2cpp.hpp:1957
Definition pcre2cpp.hpp:310
pcre2_data< utf_type::UTF_8 > u8pcre2_data
Definition pcre2cpp.hpp:675
pcre2_data< utf_type::UTF_32 > u32pcre2_data
Definition pcre2cpp.hpp:681
pcre2_data< utf_type::UTF_16 > u16pcre2_data
Definition pcre2cpp.hpp:678
Main namespace of pcre2cpp library.
basic_regex< utf_type::UTF_16 > u16regex
Definition pcre2cpp.hpp:1918
basic_match_result< utf_type::UTF_8 > u8match_result
Definition pcre2cpp.hpp:1518
basic_match_result< utf_type::UTF_32 > u32match_result
Definition pcre2cpp.hpp:1524
u8regex regex
Definition pcre2cpp.hpp:1925
basic_regex< utf_type::UTF_32 > u32regex
Definition pcre2cpp.hpp:1921
basic_match_result< utf_type::UTF_16 > u16match_result
Definition pcre2cpp.hpp:1521
u8match_result match_result
Definition pcre2cpp.hpp:1528
u8match_value match_value
Definition pcre2cpp.hpp:1061
basic_match_value< utf_type::UTF_16 > u16match_value
Definition pcre2cpp.hpp:1054
basic_regex< utf_type::UTF_8 > u8regex
Definition pcre2cpp.hpp:1915
basic_match_value< utf_type::UTF_32 > u32match_value
Definition pcre2cpp.hpp:1057
basic_match_value< utf_type::UTF_8 > u8match_value
Definition pcre2cpp.hpp:1051
Match value container.
Definition pcre2cpp.hpp:1039
_string_type value
Definition pcre2cpp.hpp:1047
size_t relative_offset
Definition pcre2cpp.hpp:1045
Sub match value container.
Definition pcre2cpp.hpp:1075
size_t size
size of value
Definition pcre2cpp.hpp:1079
size_t relative_offset
offset relative to search offset
Definition pcre2cpp.hpp:1077
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, sptr_type)> substring_number_from_name
pointer to pcre2_substring_number_from_name function for utf-16
Definition pcre2cpp.hpp:568
string_type::value_type string_char_type
cpp string char type for utf-16
Definition pcre2cpp.hpp:516
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< size_t *(match_data_type *)> get_ovector_ptr
pointer to pcre2_get_ovector_pointer function for utf-16
Definition pcre2cpp.hpp:551
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(int, uchar_type *, size_t)> get_error_message
pointer to pcre2_get_error_message function for utf-16
Definition pcre2cpp.hpp:558
pcre2_compile_context_16 compile_ctx_type
pcre2 compile context structure type for utf-16
Definition pcre2cpp.hpp:491
pcre2_general_context_16 general_ctx_type
pcre2 general context structure type for utf-16
Definition pcre2cpp.hpp:493
pcre2_code_16 code_type
pcre2 code structure type for utf-16
Definition pcre2cpp.hpp:489
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< uint32_t(match_data_type *)> get_ovector_count
pointer to pcre2_get_ovector_count function for utf-16
Definition pcre2cpp.hpp:553
static _PCRE2CPP_CONSTEXPR17 utf_type uft
utf enum value for utf-16
Definition pcre2cpp.hpp:521
static _PCRE2CPP_CONSTEXPR17 size_t utf_size
utf byte size for utf-16
Definition pcre2cpp.hpp:523
pcre2_match_data_16 match_data_type
pcre2 match data structure type for utf-16
Definition pcre2cpp.hpp:498
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< match_data_type *(const code_type *, general_ctx_type *)> match_data_from_pattern
pointer to pcre2_match_data_create_from_pattern function for utf-16
Definition pcre2cpp.hpp:537
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< code_type *(sptr_type, size_t, uint32_t, int *, size_t *, compile_ctx_type *)> compile
pointer to pcre2_compile function for utf-16
Definition pcre2cpp.hpp:529
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, sptr_type, size_t, size_t, uint32_t, match_data_type *, match_ctx_type *)> match
pointer to pcre2_match function for utf-16
Definition pcre2cpp.hpp:546
pcre2_match_context_16 match_ctx_type
pcre2 match context structure type for utf-16
Definition pcre2cpp.hpp:500
std::u16string_view string_view_type
cpp string view type for utf-16
Definition pcre2cpp.hpp:514
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, uint32_t, void *)> get_info
pointer to pcre2_pattern_info function for utf-16
Definition pcre2cpp.hpp:563
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< void(code_type *)> code_free
pointer to pcre2_code_free function for utf-16
Definition pcre2cpp.hpp:531
PCRE2_UCHAR16 uchar_type
pcre2 unsigned char type for utf-16
Definition pcre2cpp.hpp:507
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< void(match_data_type *)> match_data_free
pointer to pcre2_match_data_free function for utf-16
Definition pcre2cpp.hpp:539
std::u16string string_type
cpp string type for utf-16
Definition pcre2cpp.hpp:512
PCRE2_SPTR16 sptr_type
pcre2 string pointer type for utf-16
Definition pcre2cpp.hpp:505
static _PCRE2CPP_CONSTEXPR17 utf_type uft
utf enum value for utf-32
Definition pcre2cpp.hpp:619
pcre2_compile_context_32 compile_ctx_type
pcre2 compile context structure type for utf-32
Definition pcre2cpp.hpp:589
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< size_t *(match_data_type *)> get_ovector_ptr
pointer to pcre2_get_ovector_pointer function for utf-32
Definition pcre2cpp.hpp:649
static _PCRE2CPP_CONSTEXPR17 size_t utf_size
utf byte size for utf-32
Definition pcre2cpp.hpp:621
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(int, uchar_type *, size_t)> get_error_message
pointer to pcre2_get_error_message function for utf-32
Definition pcre2cpp.hpp:656
string_type::value_type string_char_type
cpp string char type for utf-32
Definition pcre2cpp.hpp:614
pcre2_code_32 code_type
pcre2 code structure type for utf-32
Definition pcre2cpp.hpp:587
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< void(code_type *)> code_free
pointer to pcre2_code_free function for utf-32
Definition pcre2cpp.hpp:629
pcre2_general_context_32 general_ctx_type
pcre2 general context structure type for utf-32
Definition pcre2cpp.hpp:591
PCRE2_UCHAR32 uchar_type
pcre2 unsigned char type for utf-32
Definition pcre2cpp.hpp:605
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< void(match_data_type *)> match_data_free
pointer to pcre2_match_data_free function for utf-32
Definition pcre2cpp.hpp:637
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< match_data_type *(const code_type *, general_ctx_type *)> match_data_from_pattern
pointer to pcre2_match_data_create_from_pattern function for utf-32
Definition pcre2cpp.hpp:635
PCRE2_SPTR32 sptr_type
pcre2 string pointer type for utf-32
Definition pcre2cpp.hpp:603
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, sptr_type)> substring_number_from_name
pointer to pcre2_substring_number_from_name function for utf-32
Definition pcre2cpp.hpp:666
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< code_type *(sptr_type, size_t, uint32_t, int *, size_t *, compile_ctx_type *)> compile
pointer to pcre2_compile function for utf-32
Definition pcre2cpp.hpp:627
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, sptr_type, size_t, size_t, uint32_t, match_data_type *, match_ctx_type *)> match
pointer to pcre2_match function for utf-32
Definition pcre2cpp.hpp:644
pcre2_match_context_32 match_ctx_type
pcre2 match context structure type for utf-32
Definition pcre2cpp.hpp:598
std::u32string_view string_view_type
cpp string view type for utf-32
Definition pcre2cpp.hpp:612
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< uint32_t(match_data_type *)> get_ovector_count
pointer to pcre2_get_ovector_count function for utf-32
Definition pcre2cpp.hpp:651
pcre2_match_data_32 match_data_type
pcre2 match data structure type for utf-32
Definition pcre2cpp.hpp:596
std::u32string string_type
cpp string type for utf-32
Definition pcre2cpp.hpp:610
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, uint32_t, void *)> get_info
pointer to pcre2_pattern_info function for utf-32
Definition pcre2cpp.hpp:661
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< code_type *(sptr_type, size_t, uint32_t, int *, size_t *, compile_ctx_type *)> compile
pointer to pcre2_compile function for utf-8
Definition pcre2cpp.hpp:431
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, uint32_t, void *)> get_info
pointer to pcre2_pattern_info function for utf-8
Definition pcre2cpp.hpp:465
pcre2_match_context_8 match_ctx_type
pcre2 match context structure type for utf-8
Definition pcre2cpp.hpp:395
static _PCRE2CPP_CONSTEXPR17 size_t utf_size
utf byte size for utf-8
Definition pcre2cpp.hpp:425
PCRE2_UCHAR8 uchar_type
pcre2 unsigned char type for utf-8
Definition pcre2cpp.hpp:402
static _PCRE2CPP_CONSTEXPR17 utf_type uft
utf enum value for utf-8
Definition pcre2cpp.hpp:423
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< void(match_data_type *)> match_data_free
pointer to pcre2_match_data_free function for utf-8
Definition pcre2cpp.hpp:441
pcre2_compile_context_8 compile_ctx_type
pcre2 compile context structure type for utf-8
Definition pcre2cpp.hpp:386
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< uint32_t(match_data_type *)> get_ovector_count
pointer to pcre2_get_ovector_count function for utf-8
Definition pcre2cpp.hpp:455
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< match_data_type *(const code_type *, general_ctx_type *)> match_data_from_pattern
pointer to pcre2_match_data_create_from_pattern function for utf-8
Definition pcre2cpp.hpp:439
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(int, uchar_type *, size_t)> get_error_message
pointer to pcre2_get_error_message function for utf-8
Definition pcre2cpp.hpp:460
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< size_t *(match_data_type *)> get_ovector_ptr
pointer to pcre2_get_ovector_pointer function for utf-8
Definition pcre2cpp.hpp:453
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< void(code_type *)> code_free
pointer to pcre2_code_free function for utf-8
Definition pcre2cpp.hpp:433
pcre2_match_data_8 match_data_type
pcre2 match data structure type for utf-8
Definition pcre2cpp.hpp:393
std::string string_type
cpp string type for utf-8
Definition pcre2cpp.hpp:414
PCRE2_SPTR8 sptr_type
pcre2 string pointer type for utf-8
Definition pcre2cpp.hpp:400
string_type::value_type string_char_type
cpp string char type for utf-8
Definition pcre2cpp.hpp:418
pcre2_general_context_8 general_ctx_type
pcre2 general context structure type for utf-8
Definition pcre2cpp.hpp:388
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, sptr_type)> substring_number_from_name
pointer to pcre2_substring_number_from_name function for utf-8
Definition pcre2cpp.hpp:470
pcre2_code_8 code_type
pcre2 code structure type for utf-8
Definition pcre2cpp.hpp:384
std::string_view string_view_type
cpp string view type for utf-8
Definition pcre2cpp.hpp:416
static _PCRE2CPP_CONSTEXPR17 mstd::c_func_t< int(const code_type *, sptr_type, size_t, size_t, uint32_t, match_data_type *, match_ctx_type *)> match
pointer to pcre2_match function for utf-8
Definition pcre2cpp.hpp:448
Translation container from pcre2 library to pcre2cpp.
Definition pcre2cpp.hpp:372