libhext: C++ Library Documentation 1.0.13-b24695d
|
Filters a string according to a given regex. More...
#include <RegexPipe.h>
Public Member Functions | |
RegexPipe (boost::regex regex) | |
Constructs a RegexPipe from a boost::regex. | |
std::string | transform (std::string str) const override |
Filters the string according to the regex given in the constructor. | |
![]() | |
virtual std::unique_ptr< StringPipe > | clone () const override |
Clones objects of template type Derived and returns an owning pointer to the newly allocated Base. | |
![]() | |
StringPipe () noexcept | |
StringPipe (const StringPipe &other) | |
StringPipe (StringPipe &&) noexcept=default | |
StringPipe & | operator= (const StringPipe &other) |
StringPipe & | operator= (StringPipe &&) noexcept=default |
virtual | ~StringPipe () noexcept=default |
std::string | pipe (std::string str) const |
Calls StringPipe::transform successively until the whole StringPipe chain was traversed. | |
void | append (std::unique_ptr< StringPipe > pipe) noexcept |
Append a StringPipe at the end of the chain. | |
template<typename StringPipeType , typename... Args> | |
void | emplace (Args &&... arg) |
Construct a StringPipe at the end of the chain. | |
Filters a string according to a given regex.
Input | Regex | Result |
---|---|---|
Highway 61 revisited | \d+ | 61 |
Highway 61 revisited | Highway \d+ | Highway 61 |
Highway 61 revisited | Highway (\d+) | 61 |
Highway 61 revisited | \w+ | Highway |
Highway 61 revisited | (\w+) (\d+) | Highway (not an error) |
Definition at line 49 of file RegexPipe.h.
|
explicit |
Constructs a RegexPipe from a boost::regex.
regex | A regular expression that is applied to the string. See RegexPipeBehavior. |
|
overridevirtual |
Filters the string according to the regex given in the constructor.
See RegexPipeBehavior.
Implements hext::StringPipe.