libshevek
|
Use regular expressions. More...
#include <regexp.hh>
Public Member Functions | |
regexp (std::string const &pattern=std::string(), bool case_sensitive=false) | |
Create a new object, and optionally fill it with a pattern. | |
regexp & | operator= (std::string const &pattern) |
Set a pattern, removing the previous one. | |
regexp (regexp const &that) | |
Copy a regexp. | |
regexp & | operator= (regexp const &that) |
Copy a regexp. | |
void | case_sensitive (bool value=true) |
Set whether the evaluation should be case sensitive. | |
~regexp () | |
Destructor, this cleans up internal structures. | |
bool | operator() (std::string const &data) |
Check whether the pattern matches a string, and fill internal match structures if it does. | |
std::string | operator[] (unsigned idx) const |
Retrieve the value of a subexpression from the last matched string. | |
bool | valid (unsigned idx) const |
Test whether a subexpression was filled by the last matching string. | |
unsigned | size () const |
Get the number of subexpression. | |
std::string | transform (std::string const &data) const |
Transform a string with \-codes according to the last matching string. | |
std::string const & | pattern () const |
Get the current pattern. |
Use regular expressions.
std::string shevek::regexp::operator[] | ( | unsigned | idx | ) | const |
Retrieve the value of a subexpression from the last matched string.
This throws an exception if the subexpression is not valid.