Doxygen
|
Class representing a regular expression. More...
#include <src/regex.h>
Classes | |
class | Private |
Private members of a regular expression. More... |
Public Types | |
enum class | Mode { RegEx , Wildcard } |
Matching algorithm. More... |
Public Member Functions | |
Ex (std::string_view pattern, Mode mode=Mode::RegEx) | |
Creates a regular expression object given the pattern as a string. | |
~Ex () | |
Destroys the regular expression object. | |
bool | match (std::string_view str, Match &match, size_t pos=0) const |
Check if a given string matches this regular expression. | |
bool | isValid () const |
Private Attributes | |
std::unique_ptr< Private > | p |
Class representing a regular expression.
It has a similar API as std::regex, but is much faster (and also somewhat more limited).
|
strong |
reg::Ex::Ex | ( | std::string_view | pattern, |
Mode | mode = Mode::RegEx ) |
Creates a regular expression object given the pattern as a string.
Two modes of matching are supported: RegEx and Wildcard
The following special characters are supported in Mode::RegEx mode.
A character range can be used to match a character that falls inside a range (or set of ranges). Within the opening [ and closing ] brackets of a character ranges the following is supported:
In Wildcard mode * is used to match any sequence of zero or more characters. The character ? can be used to match an optional character. Character ranges are also supported, but other characters like $ and + are just treated as literal characters.
Definition at line 694 of file regex.cpp.
References p, RegEx, and reg::wildcard2regex().
Referenced by ~Ex().
|
default |
bool reg::Ex::isValid | ( | ) | const |
Definition at line 741 of file regex.cpp.
References p.
Referenced by genericPatternMatch(), and getFilterFromList().
bool reg::Ex::match | ( | std::string_view | str, |
Match & | match, | ||
size_t | pos = 0 ) const |
Check if a given string matches this regular expression.
str | The input string to match against. |
match | The match object to hold the matching results. |
pos | The position in the string at which to start the match. |
Definition at line 706 of file regex.cpp.
References reg::PToken::asciiValue(), reg::PToken::BeginOfLine, reg::PToken::Character, DBG, reg::PToken::kind(), match(), and p.
Referenced by match(), reg::match(), reg::match(), reg::Ex::Private::matchAt(), reg::replace(), reg::search(), reg::search(), and ~Ex().
|
private |