API¶
-
class
ctll::fixed_string¶ A compile-time fixed string.
Example:
static constexpr auto pattern = ctll::fixed_string{ "h.*" }; constexpr auto match(std::string_view sv) noexcept { return ctre::match<pattern>(sv); }
-
template<class
Iterator, class ...Captures>
classctre::regex_results¶ -
using
char_type= typename std::iterator_traits<Iterator>::value_type¶ The character type used by the
Iterator.
-
template<size_t
Id>
constexpr captured_content<Id, void>::storage<Iterator>get()¶ -
template<class
Name>
constexpr captured_content<deduced, Name>::storage<Iterator>get()¶ -
template<ctll::fixed_string
Name>
constexpr captured_content<deduced, Name>::storage<Iterator>get()¶ Returns the capture specified by
IdorName. ID0is the full match, ID1is the first capture group, ID2is the second, etc. Named groups are specified using(?<name>).Example:
if (auto m = ctre::match<"(?<chars>[a-z]+)([0-9]+)">("abc123")) { m.get<"chars">(); //abc m.get<2>(); //123 }
-
constexpr size_t
size()¶ Returns the number of captures in this result object.
-
constexpr
operator bool() const noexcept¶ Returns whether the match was successful.
-
using
-
template<size_t
Id, typenameName= void>
classcaptured_content¶ -
template<typename
Iterator>
classstorage¶ -
constexpr auto
begin() const noexcept¶ -
constexpr auto
end() const noexcept¶ Returns the begin or end iterator for the captured content.
-
constexpr
operator bool() const noexcept¶ Returns whether the match was successful.
-
constexpr auto
size() const noexcept¶ Returns the number of characters in the capture.
-
constexpr
operator std::basic_string_view<char_type>() const noexcept¶ -
constexpr std::basic_string_view<char_type>
to_view() const noexcept¶ -
constexpr std::basic_string_view<char_type>
view() const noexcept¶ Converts the capture to a string view.
-
explicit constexpr
operator std::basic_string<char_type>() const noexcept¶ -
constexpr std::basic_string<char_type>
to_string() const noexcept¶ -
constexpr std::basic_string<char_type>
str() const noexcept¶ Converts the capture to a string view.
-
static constexpr size_t
get_id() noexcept¶ Returns
Id
-
constexpr auto
-
template<typename
-
template<auto &
RE, class ...Args>
constexpr ctre::regex_results<deduced>match(Args&&... args)¶ -
template<ctll::fixed_string
RE, class ...Args>
constexpr ctre::regex_results<deduced>match(Args&&... args)¶ Matches
REagainst the whole input.Args...must be either a string-like object withbeginandendmember functions, or a pair of forward iterators.
-
template<auto &
RE, class ...Args>
constexpr ctre::regex_results<deduced>search(Args&&... args)¶ -
template<ctll::fixed_string
RE, class ...Args>
constexpr ctre::regex_results<deduced>search(Args&&... args)¶ Searches for a match somewhere within the input.
Args...must be either a string-like object withbeginandendmember functions, or a pair of forward iterators.