libzypp: zypp::str::regex Class Reference

libzypp 17.38.14

zypp::str::regex Class Reference
Regular expression matching

Regular expression. More...

`#include <zypp-core/base/Regex.h>`

## Public Types
enum | RegFlags { icase = REG_ICASE , nosubs = REG_NOSUB , match_extended = REG_EXTENDED , newline = REG_NEWLINE , rxdefault = match_extended|newline }
enum | MatchFlags { none = 0 , not_bol = REG_NOTBOL }

## Public Member Functions
| regex ()
| regex (const std::string &s, int flags=rxdefault)
| regex (const char *s, int flags=rxdefault)
| ~regex ()
| regex (const regex &rhs)
regex & | operator= (const regex &rhs)
std::string | asString () const
| string representation of the regular expression
bool | matches (const char *s, str::smatch &matches, int flags=none) const
bool | matches (const std::string &s_r, str::smatch &matches_r, int flags_r=none) const
bool | matches (const char *s) const
bool | matches (const std::string &s_r) const
regex_t * | get ()
| Expert backdoor.

## Private Member Functions
void | assign (const std::string &s, int flags)

## Private Attributes
std::string | m_str
int | m_flags
regex_t | m_preg
bool | m_valid = false

## Friends
class | smatch

## Detailed Description

Regular expression.

Definition at line 94 of file Regex.h.

## Member Enumeration Documentation

## ◆ RegFlags

enum zypp::str::regex::RegFlags

Enumerator
icase | Do not differentiate case.
nosubs | Support for substring addressing of matches is not required.
match_extended | Use POSIX Extended Regular Expression syntax when interpreting regex.
newline | Match newline.
rxdefault | These are enforced even if you don't pass them as flag argument.

Definition at line 98 of file Regex.h.

## ◆ MatchFlags

enum zypp::str::regex::MatchFlags

Enumerator
none |
not_bol | Do not match begin of line.

Definition at line 106 of file Regex.h.

## Constructor & Destructor Documentation

## ◆ regex() [1/4]

regex::regex | ( |  | ) |

Definition at line 23 of file Regex.cc.

## ◆ regex() [2/4]

regex::regex | ( | const std::string & | s,
|  | int | flags = rxdefault )

Definition at line 27 of file Regex.cc.

## ◆ regex() [3/4]

zypp::str::regex::regex | ( | const char * | s,
|  | int | flags = rxdefault )
| inline

Definition at line 113 of file Regex.h.

## ◆ ~regex()

regex::~regex | ( |  | ) |

Definition at line 30 of file Regex.cc.

## ◆ regex() [4/4]

zypp::str::regex::regex | ( | const regex & | rhs | ) |
| inline

Definition at line 116 of file Regex.h.

## Member Function Documentation

## ◆ operator=()

regex & zypp::str::regex::operator= | ( | const regex & | rhs | ) |
| inline

Definition at line 119 of file Regex.h.

## ◆ asString()

std::string zypp::str::regex::asString | ( |  | ) | const
| inline

string representation of the regular expression

Definition at line 125 of file Regex.h.

## ◆ matches() [1/4]

bool regex::matches | ( | const char * | s,
|  | str::smatch & | matches,
|  | int | flags = none ) const

Definition at line 57 of file Regex.cc.

## ◆ matches() [2/4]

bool zypp::str::regex::matches | ( | const std::string & | s_r,
|  | str::smatch & | matches_r,
|  | int | flags_r = none ) const
| inline

Definition at line 129 of file Regex.h.

## ◆ matches() [3/4]

bool regex::matches | ( | const char * | s | ) | const

Definition at line 75 of file Regex.cc.

## ◆ matches() [4/4]

bool zypp::str::regex::matches | ( | const std::string & | s_r | ) | const
| inline

Definition at line 133 of file Regex.h.

## ◆ get()

regex_t * zypp::str::regex::get | ( |  | ) |
| inline

Expert backdoor.

Returns pointer to the compiled regex for direct use in regexec()

Definition at line 138 of file Regex.h.

## ◆ assign()

void regex::assign | ( | const std::string & | s,
|  | int | flags )
| private

Definition at line 36 of file Regex.cc.

## Friends And Related Symbol Documentation

## ◆ smatch

friend class smatch
| friend

Definition at line 145 of file Regex.h.

## Member Data Documentation

## ◆ m_str

std::string zypp::str::regex::m_str
| private

Definition at line 146 of file Regex.h.

## ◆ m_flags

int zypp::str::regex::m_flags
| private

Definition at line 147 of file Regex.h.

## ◆ m_preg

regex_t zypp::str::regex::m_preg
| private

Definition at line 148 of file Regex.h.

## ◆ m_valid

bool zypp::str::regex::m_valid = false
| private

Definition at line 149 of file Regex.h.

The documentation for this class was generated from the following files:

- zypp-core/base/Regex.h
- zypp-core/base/Regex.cc