![]() |
Spicy
|
#include <regexp.h>
Public Member Functions | |
RegExp (std::string pattern, regexp::Flags flags=regexp::Flags()) | |
RegExp (const std::vector< std::string > &patterns, regexp::Flags flags=regexp::Flags()) | |
const auto & | patterns () const |
const auto & | flags () const |
int32_t | match (const Bytes &data) const |
Vector< Bytes > | matchGroups (const Bytes &data) const |
std::tuple< int32_t, Bytes > | find (const Bytes &data) const |
regexp::MatchState | tokenMatcher () const |
Friends | |
class | regexp::MatchState |
bool | operator== (const RegExp &a, const RegExp &b) |
bool | operator!= (const RegExp &a, const RegExp &b) |
A regular expression instance.
RegExp::RegExp | ( | std::string | pattern, |
regexp::Flags | flags = regexp::Flags() |
||
) |
Instantiates a new regular expression instance.
pattern | regular expression to compile |
flags | compilation flags for the regexp |
<tt>PatternError</tt> | if the pattern cannot be compiled |
RegExp::RegExp | ( | const std::vector< std::string > & | patterns, |
regexp::Flags | flags = regexp::Flags() |
||
) |
Instantiates a new regular expression instance performing parallel set matching on multiple patterns. Set matching implicitly sets the Flags::no_sub
(even if just one pattern is passed in).
patterns | regular expressions to compile jointly |
flags | compilation flags for the regexp |
<tt>PatternError</tt> | if a pattern cannot be compiled |
Searches a pattern within a bytes view and returns the matching part. The expression is not considered anchored to the beginning of the data, it will be found at any position.
find()
. If that's larger than zero, the 2nd is the matching data. int32_t RegExp::match | ( | const Bytes & | data | ) | const |
Searches a pattern within a bytes view. The expression is considered anchored to the beginning of the data.
compileSet
the integer value then indicates the ID of the pattern that was found. If the function returns zero, no match was found and that won't change if further data gets added to the input data. If the returned value is smaller than 0, a partial match was found (i.e., no match yet but adding further data could change that). Searches a pattern within a bytes view and returns the matching data for all matching capture groups. The expression is considered anchored to the beginning of the data.
compileSet()
. regexp::MatchState RegExp::tokenMatcher | ( | ) | const |
Returns matching state initializes for incremental token matching. For token matching the regular expression will be considered implicitly anchored.