PCRE2 C++ Wrapper 1.3.0
pcre2cpp
Loading...
Searching...
No Matches
pcre2cpp::basic_regex< utf > Class Template Reference

Basic PCRE2 Regex container. More...

#include <regex.hpp>

Inheritance diagram for pcre2cpp::basic_regex< utf >:
[legend]
Collaboration diagram for pcre2cpp::basic_regex< utf >:
[legend]

Public Member Functions

_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
_PCRE2CPP_CONSTEXPR17 basic_regex (const basic_regex &other) noexcept=default
 default copy constructor
_PCRE2CPP_CONSTEXPR17 basic_regex (basic_regex &&other) noexcept=default
 default move constructor
_PCRE2CPP_CONSTEXPR20 ~basic_regex () noexcept=default
 default destructor
_PCRE2CPP_CONSTEXPR17 basic_regexoperator= (const basic_regex &other) noexcept=default
 default copy assign operator
_PCRE2CPP_CONSTEXPR17 basic_regexoperator= (basic_regex &&other) noexcept=default
 default move assign operator
_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
_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
_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
_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 variable
_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

Private Types

using _pcre2_data_t = utils::pcre2_data<utf>
using _code_type = typename _pcre2_data_t::code_type
using _code_ptr = std::shared_ptr<_code_type>
using _match_data_type = typename _pcre2_data_t::match_data_type
using _match_data_ptr = std::shared_ptr<_match_data_type>
using _string_type = typename _pcre2_data_t::string_type
using _string_view_type = typename _pcre2_data_t::string_view_type
using _string_char_type = typename _pcre2_data_t::string_char_type
using _match_value_type = basic_match_value<utf>
using _match_result_type = basic_match_result<utf>
using _sptr_type = typename _pcre2_data_t::sptr_type
using _named_sub_values_table = typename _pcre2_data_t::named_sub_values_table
using _named_sub_values_table_ptr = std::shared_ptr<_named_sub_values_table>
using _uchar_type = typename _pcre2_data_t::uchar_type
using _regex_exception = basic_regex_exception<utf>

Private Attributes

_code_ptr _code = nullptr
 pointer to compiled pcre2 code
_match_data_ptr _match_data = nullptr
 pointer to match data of pcre2 code
_named_sub_values_table_ptr _named_sub_values = nullptr
 pointer to conversion table of named groups to their index

Detailed Description

template<utf_type utf>
class pcre2cpp::basic_regex< utf >

Basic PCRE2 Regex container.

Template Parameters
utfUTF type

Member Typedef Documentation

◆ _code_ptr

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_code_ptr = std::shared_ptr<_code_type>
private

◆ _code_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_code_type = typename _pcre2_data_t::code_type
private

◆ _match_data_ptr

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_match_data_ptr = std::shared_ptr<_match_data_type>
private

◆ _match_data_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_match_data_type = typename _pcre2_data_t::match_data_type
private

◆ _match_result_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_match_result_type = basic_match_result<utf>
private

◆ _match_value_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_match_value_type = basic_match_value<utf>
private

◆ _named_sub_values_table

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_named_sub_values_table = typename _pcre2_data_t::named_sub_values_table
private

◆ _named_sub_values_table_ptr

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_named_sub_values_table_ptr = std::shared_ptr<_named_sub_values_table>
private

◆ _pcre2_data_t

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_pcre2_data_t = utils::pcre2_data<utf>
private

◆ _regex_exception

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_regex_exception = basic_regex_exception<utf>
private

◆ _sptr_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_sptr_type = typename _pcre2_data_t::sptr_type
private

◆ _string_char_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_string_char_type = typename _pcre2_data_t::string_char_type
private

◆ _string_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_string_type = typename _pcre2_data_t::string_type
private

◆ _string_view_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_string_view_type = typename _pcre2_data_t::string_view_type
private

◆ _uchar_type

template<utf_type utf>
using pcre2cpp::basic_regex< utf >::_uchar_type = typename _pcre2_data_t::uchar_type
private

Constructor & Destructor Documentation

◆ basic_regex() [1/3]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR20 pcre2cpp::basic_regex< utf >::basic_regex ( const _string_view_type pattern,
const compile_options opts = compile_options_bits::None )
inlineexplicit

basic regex container with pattern and compile options

◆ basic_regex() [2/3]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 pcre2cpp::basic_regex< utf >::basic_regex ( const basic_regex< utf > & other)
defaultnoexcept

default copy constructor

◆ basic_regex() [3/3]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 pcre2cpp::basic_regex< utf >::basic_regex ( basic_regex< utf > && other)
defaultnoexcept

default move constructor

◆ ~basic_regex()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR20 pcre2cpp::basic_regex< utf >::~basic_regex ( )
defaultnoexcept

default destructor

Member Function Documentation

◆ match() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR20 bool pcre2cpp::basic_regex< utf >::match ( const _string_view_type text,
_match_result_type & result,
const size_t offset = 0,
const match_options opts = match_options_bits::None ) const
inlinenoexcept

returns true if match was found and result is stored in result variable

◆ match() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_regex< utf >::match ( const _string_view_type text,
const size_t offset = 0,
const match_options opts = match_options_bits::None ) const
inline

returns true if match was found

◆ match_all()

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_regex< utf >::match_all ( const _string_view_type text,
std::vector< _match_result_type > & results,
size_t offset = 0 ) const
inlinenoexcept

returns true if any match was found and all results store in results array

◆ match_at() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_regex< utf >::match_at ( const _string_view_type text,
_match_result_type & result,
const size_t offset = 0 ) const
inlinenoexcept

returns true if match was found, and it has relative offset == 0 and result is stored in result variable

◆ match_at() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 bool pcre2cpp::basic_regex< utf >::match_at ( const _string_view_type text,
const size_t offset = 0 ) const
inlinenoexcept

returns true if match was found, and it has relative offset == 0

◆ operator=() [1/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 basic_regex & pcre2cpp::basic_regex< utf >::operator= ( basic_regex< utf > && other)
defaultnoexcept

default move assign operator

◆ operator=() [2/2]

template<utf_type utf>
_PCRE2CPP_CONSTEXPR17 basic_regex & pcre2cpp::basic_regex< utf >::operator= ( const basic_regex< utf > & other)
defaultnoexcept

default copy assign operator

Member Data Documentation

◆ _code

template<utf_type utf>
_code_ptr pcre2cpp::basic_regex< utf >::_code = nullptr
private

pointer to compiled pcre2 code

◆ _match_data

template<utf_type utf>
_match_data_ptr pcre2cpp::basic_regex< utf >::_match_data = nullptr
private

pointer to match data of pcre2 code

◆ _named_sub_values

template<utf_type utf>
_named_sub_values_table_ptr pcre2cpp::basic_regex< utf >::_named_sub_values = nullptr
private

pointer to conversion table of named groups to their index