26#if ! defined (octave_lo_regexp_h)
27#define octave_lo_regexp_h 1
29#include "octave-config.h"
50 const std::string& w =
"regexp")
51 : m_pattern (pat), m_options (opt), m_code (nullptr), m_named_pats (),
52 m_names (0), m_named_idx (), m_who (w)
71 match_data match (
const std::string& buffer)
const;
73 bool is_match (
const std::string& buffer)
const;
77 std::string replace (
const std::string& buffer,
78 const std::string& replacement)
const;
81 match (
const std::string& pat,
const std::string& buffer,
83 const std::string& who =
"regexp")
87 return rx.
match (buffer);
91 is_match (
const std::string& pat,
const std::string& buffer,
93 const std::string& who =
"regexp")
103 const std::string& who =
"regexp")
105 regexp rx (pat, opt, who);
111 replace (
const std::string& pat,
const std::string& buffer,
112 const std::string& replacement,
114 const std::string& who =
"regexp")
116 regexp rx (pat, opt, who);
118 return rx.
replace (buffer, replacement);
126 : m_case_insensitive (false), m_dotexceptnewline (false),
127 m_emptymatch (false), m_freespacing (false), m_lineanchors (false),
141 void once (
bool val) { m_once = val; }
148 bool once ()
const {
return m_once; }
152 bool m_case_insensitive;
153 bool m_dotexceptnewline;
167 const std::string& ms,
const Matrix& te,
169 : m_match_string (ms), m_named_tokens (nt), m_tokens (t),
170 m_token_extents (te), m_start (s), m_end (e)
175 std::
string match_string ()
const {
return m_match_string; }
179 double start ()
const {
return m_start; }
180 double end ()
const {
return m_end; }
184 std::string m_match_string;
220 std::string m_pattern;
234 void compile_internal ();
237OCTAVE_END_NAMESPACE(octave)
N Dimensional Array with copy-on-write semantics.
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
static Array< bool > is_match(const std::string &pat, const string_vector &buffer, const regexp::opts &opt=regexp::opts(), const std::string &who="regexp")
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 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