PixelLightAPI
.
|
Regular expression class (PCRE syntax) More...
#include <RegEx.h>
Public Types | |
enum | EFlags { MatchCaseSensitive = 1, MatchGreedy = 2, EncodingASCII = 4, EncodingUTF8 = 8, Multiline = 16, DotAll = 32 } |
Matching and encoding flags. More... | |
Public Member Functions | |
RegEx () | |
Constructor. | |
RegEx (const String &sExpression, uint32 nFlags=MatchCaseSensitive|MatchGreedy) | |
Constructor. | |
RegEx (const RegEx &cRegEx) | |
Copy constructor. | |
PLCORE_API | ~RegEx () |
Destructor. | |
RegEx & | operator= (const RegEx &cRegEx) |
Assignment operator. | |
String | GetExpression () const |
Get regular expression. | |
PLCORE_API void | SetExpression (const String &sExpression, uint32 nFlags=MatchCaseSensitive|MatchGreedy) |
Set regular expression. | |
bool | IsValid () const |
Check if the regular expression is valid. | |
uint32 | GetFlags () const |
Get mode and encoding flags. | |
bool | IsCaseSensitive () const |
Is the expression case sensitive? | |
bool | IsGreedy () const |
Is the expression greedy? | |
bool | IsASCII () const |
Is ASCII encoding used? | |
bool | IsUTF8 () const |
Is UTF8 encoding used? | |
PLCORE_API void | Study () |
Analyze the regular expression and store additional internal information. | |
PLCORE_API bool | Match (const String &sSubject, uint32 nPosition=0) |
Check if a string matches the given regular expression. | |
int | GetPosition () const |
Get current byte position in the subject string. | |
const Array< String > & | GetResults () const |
Get the results of the last check. | |
String | GetResult (uint32 nIndex) const |
Get a matching group from the last check. | |
const Map< String, String > & | GetNameResults () const |
Get the results of the last check by name. | |
String | GetNameResult (const String &sName) const |
Get a matching group from the last check by name. | |
void | ClearResults () |
Clear all results. | |
Static Public Member Functions | |
static PLCORE_API String | WildcardToRegEx (const String &sWildcard) |
Converts a given wildcard into a regular expression. |
Regular expression class (PCRE syntax)
Matching and encoding flags.
PLCore::RegEx::RegEx | ( | ) | [inline] |
PLCore::RegEx::RegEx | ( | const String & | sExpression, |
uint32 | nFlags = MatchCaseSensitive | MatchGreedy |
||
) | [inline] |
[in] | sExpression | Regular expression |
[in] | nFlags | Processing mode and encoding (combination of EFlags values) |
PLCore::RegEx::RegEx | ( | const RegEx & | cRegEx | ) | [inline] |
Copy constructor.
[in] | cRegEx | RegEx to copy |
PLCORE_API PLCore::RegEx::~RegEx | ( | ) |
Destructor.
static PLCORE_API String PLCore::RegEx::WildcardToRegEx | ( | const String & | sWildcard | ) | [static] |
Converts a given wildcard into a regular expression.
[in] | sWildcard | String with wildcard to convert (for example "BeerNumber*") |
String PLCore::RegEx::GetExpression | ( | ) | const [inline] |
Get regular expression.
PLCORE_API void PLCore::RegEx::SetExpression | ( | const String & | sExpression, |
uint32 | nFlags = MatchCaseSensitive|MatchGreedy |
||
) |
Set regular expression.
[in] | sExpression | Regular expression |
[in] | nFlags | Processing mode and encoding (combination of EFlags values) |
bool PLCore::RegEx::IsValid | ( | ) | const [inline] |
Check if the regular expression is valid.
uint32 PLCore::RegEx::GetFlags | ( | ) | const [inline] |
Get mode and encoding flags.
bool PLCore::RegEx::IsCaseSensitive | ( | ) | const [inline] |
Is the expression case sensitive?
bool PLCore::RegEx::IsGreedy | ( | ) | const [inline] |
Is the expression greedy?
bool PLCore::RegEx::IsASCII | ( | ) | const [inline] |
Is ASCII encoding used?
bool PLCore::RegEx::IsUTF8 | ( | ) | const [inline] |
Is UTF8 encoding used?
PLCORE_API void PLCore::RegEx::Study | ( | ) |
Analyze the regular expression and store additional internal information.
PLCORE_API bool PLCore::RegEx::Match | ( | const String & | sSubject, |
uint32 | nPosition = 0 |
||
) |
Check if a string matches the given regular expression.
[in] | sSubject | String to test |
[in] | nPosition | Start byte position in the string, for instance a value received by 'GetPosition()' |
int PLCore::RegEx::GetPosition | ( | ) | const [inline] |
Get current byte position in the subject string.
const Array< String > & PLCore::RegEx::GetResults | ( | ) | const [inline] |
Get the results of the last check.
String PLCore::RegEx::GetResult | ( | uint32 | nIndex | ) | const [inline] |
Get a matching group from the last check.
[in] | nIndex | Which group shall be returned? |
const Map< String, String > & PLCore::RegEx::GetNameResults | ( | ) | const [inline] |
Get the results of the last check by name.
String PLCore::RegEx::GetNameResult | ( | const String & | sName | ) | const [inline] |
Get a matching group from the last check by name.
[in] | sName | Which group shall be returned? |
void PLCore::RegEx::ClearResults | ( | ) | [inline] |
Clear all results.
|