![]() |
Spicy
|
#include <regexp.h>
Public Member Functions | |
| RegExp (regexp::Pattern pattern, regexp::Flags flags=regexp::Flags()) | |
| RegExp (const regexp::Patterns &patterns, regexp::Flags flags=regexp::Flags()) | |
| RegExp () | |
| const auto & | patterns () const |
| const auto & | flags () const |
| int32_t | match (const Bytes &data) const |
| Vector< Bytes > | matchGroups (const Bytes &data) const |
| Tuple< int32_t, Bytes > | find (const Bytes &data) const |
| regexp::MatchState | tokenMatcher () const |
| jrx_regex_t * | jrx () const |
| bool | operator== (const RegExp &other) const |
Friends | |
| class | regexp::MatchState |
A regular expression instance. A regular expression can be compiled from one or more individual patterns. All provided patterns will be matched in parallel.
| RegExp::RegExp | ( | regexp::Pattern | pattern, |
| regexp::Flags | flags = regexp::Flags() |
||
| ) |
Instantiates a new regular expression instance.
| pattern | a single regular expression pattern to compile |
| flags | compilation flags for the regexp pattern |
| <tt>PatternError</tt> | if the pattern cannot be compiled |
| RegExp::RegExp | ( | const regexp::Patterns & | patterns, |
| regexp::Flags | flags = regexp::Flags() |
||
| ) |
Instantiates a new regular expression instance performing parallel set matching on multiple patterns.
| patterns | regular expression patterns to compile jointly |
| flags | compilation flags, affecting all patterns |
| <tt>PatternError</tt> | if a pattern cannot be compiled |
| RegExp::RegExp | ( | ) |
Instantiates an empty regular expression without any patterns. This is a valid instance that however cannot be used with any matching functionality. Doing will produce runtime errors.
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.
|
inline |
Accessor to underlying JRX state. Intended for internal use and testing.
| 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.