Perl-compatible regex.
More...
#include <PCRE2.h>
|
|
| PCRE2 () noexcept |
| | Constructs an empty PCRE2.
|
| |
|
| PCRE2 (const PCRE2 &)=delete |
| |
|
PCRE2 & | operator= (const PCRE2 &)=delete |
| |
|
| PCRE2 (PCRE2 &&other) noexcept |
| | Move constructor.
|
| |
|
PCRE2 & | operator= (PCRE2 &&other) noexcept |
| | Move assignment.
|
| |
| bool | compile (std::string_view regex, uint32_t options=0) noexcept |
| | Compile PCRE2 regex with passed options. More...
|
| |
| int | match (std::string_view subject) noexcept |
| | PCRE2 against subject. More...
|
| |
| auto | ovector () const |
| | Returns offset (into the subject string) vector for all matches. More...
|
| |
| auto | matches (std::string_view subject, unsigned matches) const noexcept |
| | Returns Matches (a pseudo-vector of matches) in subject. More...
|
| |
| auto | matchByIdx (std::string_view subject, unsigned index) const noexcept |
| | Returns one match – a substring of subject. More...
|
| |
|
auto | lastErrno () const noexcept |
| | Return the last error number.
|
| |
|
auto | lastError () const noexcept |
| | Return the last error string if any.
|
| |
|
auto | lastOffset () const noexcept |
| | Get offset of last error (to the regex string)
|
| |
|
bool | valid () const noexcept |
| | Test whether PCRE2 is valid.
|
| |
|
| operator bool () const noexcept |
| | bool wrapper around valid()
|
| |
|
bool | operator! () const noexcept |
| | ! wrapper around valid()
|
| |
◆ compile()
| bool SlPCRE2::PCRE2::compile |
( |
std::string_view |
regex, |
|
|
uint32_t |
options = 0 |
|
) |
| |
|
inlinenoexcept |
Compile PCRE2 regex with passed options.
- Parameters
-
| regex | Regex to compile |
| options | Options to use (like PCRE2_CASELESS) |
- Returns
- true on success
◆ errToStr()
| static std::string SlPCRE2::PCRE2::errToStr |
( |
int |
err | ) |
|
|
inlinestatic |
Converts PCRE2 error code err to string.
- Parameters
-
- Returns
- Error string.
◆ match()
| int SlPCRE2::PCRE2::match |
( |
std::string_view |
subject | ) |
|
|
inlinenoexcept |
PCRE2 against subject.
- Parameters
-
| subject | Text to match the regex to |
- Returns
- negative on error, 1 for no match, 2 for one group matched, ...
◆ matchByIdx()
| auto SlPCRE2::PCRE2::matchByIdx |
( |
std::string_view |
subject, |
|
|
unsigned |
index |
|
) |
| const |
|
inlinenoexcept |
Returns one match – a substring of subject.
- Parameters
-
| subject | Subject matched |
| index | Index of the requested match |
- Returns
- Matched string.
◆ matches()
| auto SlPCRE2::PCRE2::matches |
( |
std::string_view |
subject, |
|
|
unsigned |
matches |
|
) |
| const |
|
inlinenoexcept |
Returns Matches (a pseudo-vector of matches) in subject.
- Parameters
-
| subject | Subject matched |
| matches | Number of matches – the return value of match() |
- Returns
- Pseudo-vector of matches.
◆ ovector()
| auto SlPCRE2::PCRE2::ovector |
( |
| ) |
const |
|
inline |
Returns offset (into the subject string) vector for all matches.
- Returns
- An array of size_t values.
Preferrably, use matches() or matchByIdx() wrappers.
The documentation for this class was generated from the following file:
- /home/abuild/rpmbuild/BUILD/slhelpers-20260428.f233ce9/include/pcre2/PCRE2.h