ARC SDK
Public Member Functions
Arc::RegularExpression Class Reference

A regular expression class. More...

#include <arc/ArcRegex.h>

Public Member Functions

 RegularExpression ()
 Default constructor. More...
 
 RegularExpression (std::string pattern, bool ignoreCase=false)
 Creates a regex from a pattern string. More...
 
 RegularExpression (const RegularExpression &regex)
 Copy constructor. More...
 
 ~RegularExpression ()
 Destructor. More...
 
RegularExpressionoperator= (const RegularExpression &regex)
 Assignment operator. More...
 
bool isOk ()
 Returns true if the pattern of this regex is ok. More...
 
bool hasPattern (std::string str)
 Returns true if this regex has the pattern provided. More...
 
bool match (const std::string &str) const
 Returns true if this regex matches whole string provided. More...
 
bool match (const std::string &str, std::list< std::string > &unmatched, std::list< std::string > &matched) const
 Returns true if this regex matches the string provided. More...
 
bool match (const std::string &str, std::vector< std::string > &matched) const
 Try to match string. More...
 
std::string getPattern () const
 Returns pattern. More...
 

Detailed Description

A regular expression class.

This class is a wrapper around the functions provided in regex.h.

Constructor & Destructor Documentation

◆ RegularExpression() [1/3]

Arc::RegularExpression::RegularExpression ( )

Default constructor.

◆ RegularExpression() [2/3]

Arc::RegularExpression::RegularExpression ( std::string  pattern,
bool  ignoreCase = false 
)

Creates a regex from a pattern string.

Since
Changed in 4.1.0. ignoreCase argument was added.

◆ RegularExpression() [3/3]

Arc::RegularExpression::RegularExpression ( const RegularExpression regex)

Copy constructor.

◆ ~RegularExpression()

Arc::RegularExpression::~RegularExpression ( )

Destructor.

Member Function Documentation

◆ getPattern()

std::string Arc::RegularExpression::getPattern ( ) const

Returns pattern.

◆ hasPattern()

bool Arc::RegularExpression::hasPattern ( std::string  str)

Returns true if this regex has the pattern provided.

◆ isOk()

bool Arc::RegularExpression::isOk ( )

Returns true if the pattern of this regex is ok.

◆ match() [1/3]

bool Arc::RegularExpression::match ( const std::string &  str) const

Returns true if this regex matches whole string provided.

◆ match() [2/3]

bool Arc::RegularExpression::match ( const std::string &  str,
std::list< std::string > &  unmatched,
std::list< std::string > &  matched 
) const

Returns true if this regex matches the string provided.

Unmatched parts of the string are stored in 'unmatched'. Matched parts of the string are stored in 'matched'. The first entry in matched is the string that matched the regex, and the following entries are parenthesised elements of the regex.

◆ match() [3/3]

bool Arc::RegularExpression::match ( const std::string &  str,
std::vector< std::string > &  matched 
) const

Try to match string.

The passed string is matched against this regular expression. If string matches, any matched subexpression will be appended to the passed vector, for any conditional subexpression failing to match a empty is appended.

Parameters
strstring to match against this regular expression.
matchedvector which to append matched subexpressions to.
Returns
true is returned is string matches, otherwise false.
Since
Added in 4.1.0.

◆ operator=()

RegularExpression& Arc::RegularExpression::operator= ( const RegularExpression regex)

Assignment operator.

Python interface deviation
Method is unavailable in Python interface

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