libzypp: Regular expression matching

libzypp 17.38.8

Regular expression matching

Regular expressions using the glibc regex library. More...

## Classes
class | zypp::str::regex
| Regular expression. More...
class | zypp::str::smatch
| Regular expression match result. More...

## Functions
bool | zypp::str::regex_match (const char *s, smatch &matches, const regex &regex) ZYPP_API
| Regular expression matching.

## Detailed Description

Regular expressions using the glibc regex library.

See also
  also StrMatcher string matcher also supporting globing, etc.

str::regex rxexpr( "^(A)?([0-9]*) im" );
str::smatch what;
std::string mytext( "Y123 imXXXX" );
if ( str::regex_match( mytext, what, rxexpr ) )
{
MIL << "MATCH '" << what[0] << "'" << endl;
MIL << " subs: " << what.size()-1 << endl;
for_( i, 1U, what.size() )
MIL << " [" << i << "] " << what[i] << endl;
}
else
{
WAR << "NO MATCH '" << rxexpr << "' in '" << mytext << endl;
}
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
MIL
#define MIL
Definition Logger.h:103
WAR
#define WAR
Definition Logger.h:104
zypp::str::regex_match
bool regex_match(const char *s, smatch &matches, const regex &regex) ZYPP_API
Regular expression matching.
Definition Regex.cc:80

## Function Documentation

## ◆ regex_match()

bool zypp::str::regex_match | ( | const char * | s,
|  | smatch & | matches,
|  | const regex & | regex )

Regular expression matching.

relates: regex Return whether a regex matches a specific string. An optionally passed smatch object will contain the match reults.

Definition at line 80 of file Regex.cc.