26 #if ! defined (octave_lo_regexp_h)
27 #define octave_lo_regexp_h 1
29 #include "octave-config.h"
53 const std::string&
w =
"regexp")
54 : m_pattern (pat), m_options (opt), m_data (nullptr), m_named_pats (),
55 m_names (0), m_named_idx (), m_who (
w)
74 match_data match (
const std::string& buffer);
76 bool is_match (
const std::string& buffer);
80 std::string replace (
const std::string& buffer,
81 const std::string& replacement);
84 match (
const std::string& pat,
const std::string& buffer,
86 const std::string& who =
"regexp")
90 return rx.
match (buffer);
94 is_match (
const std::string& pat,
const std::string& buffer,
96 const std::string& who =
"regexp")
106 const std::string& who =
"regexp")
108 regexp rx (pat, opt, who);
114 replace (
const std::string& pat,
const std::string& buffer,
115 const std::string& replacement,
117 const std::string& who =
"regexp")
119 regexp rx (pat, opt, who);
121 return rx.
replace (buffer, replacement);
129 : m_case_insensitive (false), m_dotexceptnewline (false),
130 m_emptymatch (false), m_freespacing (false), m_lineanchors (false),
144 void once (
bool val) { m_once = val; }
151 bool once (
void)
const {
return m_once; }
168 const std::string& ms,
const Matrix& te,
170 : m_match_string (ms), m_named_tokens (nt), m_tokens (t),
171 m_token_extents (te), m_start (s), m_end (e)
182 double start (
void)
const {
return m_start; }
183 double end (
void)
const {
return m_end; }
237 void compile_internal (
void);
string_vector named_patterns(void) const
match_data(const match_data &)=default
string_vector m_named_pats
match_data(const std::list< match_element > &l, const string_vector &np)
~match_data(void)=default
match_element(const match_element &)=default
Matrix token_extents(void) const
string_vector tokens(void) const
string_vector m_named_tokens
match_element(const string_vector &nt, const string_vector &t, const std::string &ms, const Matrix &te, double s, double e)
std::string m_match_string
string_vector named_tokens(void) const
std::string match_string(void) const
void lineanchors(bool val)
void case_insensitive(bool val)
bool emptymatch(void) const
bool lineanchors(void) const
void emptymatch(bool val)
bool freespacing(void) const
void freespacing(bool val)
void dotexceptnewline(bool val)
bool dotexceptnewline(void) const
bool case_insensitive(void) const
opts(const opts &)=default
static bool is_match(const std::string &pat, const std::string &buffer, const regexp::opts &opt=regexp::opts(), const std::string &who="regexp")
match_data match(const std::string &buffer)
regexp(const std::string &pat="", const regexp::opts &opt=regexp::opts(), const std::string &w="regexp")
bool is_match(const std::string &buffer)
static Array< bool > is_match(const std::string &pat, const string_vector &buffer, const regexp::opts &opt=regexp::opts(), const std::string &who="regexp")
string_vector m_named_pats
static regexp::match_data match(const std::string &pat, const std::string &buffer, const regexp::opts &opt=regexp::opts(), const std::string &who="regexp")
std::string replace(const std::string &buffer, const std::string &replacement)
regexp(const regexp &)=default
void compile(const std::string &pat, const regexp::opts &opt=regexp::opts())
static std::string replace(const std::string &pat, const std::string &buffer, const std::string &replacement, const regexp::opts &opt=regexp::opts(), const std::string &who="regexp")
std::complex< double > w(std::complex< double > z, double relerr=0)