PIP 5.5.3
Platform-Independent Primitives
Public Member Functions | List of all members
PIRegularExpression::Matcher Class Reference

Class containing regular expression match results. More...

#include <piregularexpression.h>

Public Member Functions

 operator bool () const
 Returns true if match was found.
 
bool hasMatch () const
 Returns true if match was found.
 
bool next ()
 Attempts to find next match in subject string. More...
 
PIStringList matchedStrings () const
 Returns list of all matched strings.
 
PIString matchedString (int index=0) const
 Returns matched substring by index. More...
 
int matchedStart (int index=0) const
 Returns start position of matched substring. More...
 
int matchedSize (int index=0) const
 Returns length of matched substring. More...
 
PIString matchedString (const PIString &gname) const
 Returns matched substring by group name. More...
 
int matchedStart (const PIString &gname) const
 Returns start position of named capture group. More...
 
int matchedSize (const PIString &gname) const
 Returns length of named capture group match. More...
 

Detailed Description

Class containing regular expression match results.

Member Function Documentation

◆ next()

bool PIRegularExpression::Matcher::next ( )

Attempts to find next match in subject string.

Returns
true if next match was found

◆ matchedString() [1/2]

PIString PIRegularExpression::Matcher::matchedString ( int  index = 0) const

Returns matched substring by index.

Parameters
indexCapture group index (0 for entire match)

◆ matchedStart() [1/2]

int PIRegularExpression::Matcher::matchedStart ( int  index = 0) const

Returns start position of matched substring.

Parameters
indexCapture group index (0 for entire match)

◆ matchedSize() [1/2]

int PIRegularExpression::Matcher::matchedSize ( int  index = 0) const

Returns length of matched substring.

Parameters
indexCapture group index (0 for entire match)

◆ matchedString() [2/2]

PIString PIRegularExpression::Matcher::matchedString ( const PIString gname) const

Returns matched substring by group name.

Parameters
gnameCapture group name

◆ matchedStart() [2/2]

int PIRegularExpression::Matcher::matchedStart ( const PIString gname) const

Returns start position of named capture group.

Parameters
gnameCapture group name

◆ matchedSize() [2/2]

int PIRegularExpression::Matcher::matchedSize ( const PIString gname) const

Returns length of named capture group match.

Parameters
gnameCapture group name