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_code (nullptr), m_named_pats (),
55 m_names (0), m_named_idx (), m_who (
w)
74 match_data match (
const std::string& buffer)
const;
76 bool is_match (
const std::string& buffer)
const;
80 std::string replace (
const std::string& buffer,
81 const std::string& replacement)
const;
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 ()
const {
return m_once; }
155 bool m_case_insensitive;
156 bool m_dotexceptnewline;
170 const std::string& ms,
const Matrix& te,
172 : m_match_string (ms), m_named_tokens (nt), m_tokens (t),
173 m_token_extents (te), m_start (s), m_end (e)
178 std::
string match_string ()
const {
return m_match_string; }
182 double start ()
const {
return m_start; }
183 double end ()
const {
return m_end; }
187 std::string m_match_string;
223 std::string m_pattern;
237 void compile_internal ();
240 OCTAVE_END_NAMESPACE(
octave)
match_data(const std::list< match_element > &l, const string_vector &np)
Matrix token_extents() const
match_element(const string_vector &nt, const string_vector &t, const std::string &ms, const Matrix &te, double s, double e)
string_vector tokens() const
string_vector named_tokens() const
void dotexceptnewline(bool val)
void lineanchors(bool val)
bool case_insensitive() const
void case_insensitive(bool val)
void freespacing(bool val)
opts(const opts &)=default
bool dotexceptnewline() const
void emptymatch(bool val)
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::string replace(const std::string &buffer, const std::string &replacement) const
regexp(const std::string &pat="", const regexp::opts &opt=regexp::opts(), const std::string &w="regexp")
static bool is_match(const std::string &pat, const std::string &buffer, const regexp::opts &opt=regexp::opts(), const std::string &who="regexp")
regexp(const regexp &)=default
bool is_match(const std::string &buffer) const
match_data match(const std::string &buffer) const
static Array< bool > is_match(const std::string &pat, const string_vector &buffer, const regexp::opts &opt=regexp::opts(), const std::string &who="regexp")
static match_data match(const std::string &pat, const std::string &buffer, const regexp::opts &opt=regexp::opts(), const std::string &who="regexp")
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::complex< double > w(std::complex< double > z, double relerr=0)