18 #ifndef SHEVEK_REGEXP_HH
19 #define SHEVEK_REGEXP_HH
22 #include <sys/types.h>
32 bool m_case_sensitive;
35 std::string m_pattern, m_data;
36 void l_setup (std::string
const &
pattern,
bool destroy);
39 regexp (std::string
const &pattern = std::string (),
58 bool valid (
unsigned idx)
const;
60 unsigned size ()
const;
62 std::string
transform (std::string
const &data)
const;
64 std::string
const &
pattern ()
const;
bool operator()(std::string const &data)
Check whether the pattern matches a string, and fill internal match structures if it does...
Use regular expressions.
Definition: regexp.hh:29
~regexp()
Destructor, this cleans up internal structures.
regexp(std::string const &pattern=std::string(), bool case_sensitive=false)
Create a new object, and optionally fill it with a pattern.
std::string operator[](unsigned idx) const
Retrieve the value of a subexpression from the last matched string.
void case_sensitive(bool value=true)
Set whether the evaluation should be case sensitive.
std::string transform(std::string const &data) const
Transform a string with -codes according to the last matching string.
bool valid(unsigned idx) const
Test whether a subexpression was filled by the last matching string.
regexp & operator=(std::string const &pattern)
Set a pattern, removing the previous one.
unsigned size() const
Get the number of subexpression.
std::string const & pattern() const
Get the current pattern.