#include <cel_regex.h>
List of all members.
Detailed Description
This class provides the function of search using the Regular Expression. The regular expression is a common method of searching, matching and separation of strings.
For details for regular expression syntax, see Regular Expression.
The following is the sample code of using RegularExpression class.
void enumerate_URLs(const String& inText)
{
RegularExpression reUrl(
utf8s(
"(\\w+[\\w-]+\\w+):\\/\\/"
"(?:([^\\:]+)(?:\\:(\\w+))?\\@)?+"
"([^/:]+)"
"(?::(\\d*))?"
"([^#\\?\\s]*)"
"(\\S*)"));
if(!reUrl.findFirst(inText))
{
return;
}
do
{
printf(
"URL : \"%s\"\n"
"Scheme : \"%s\"\n"
"Username: \"%s\"\n"
"Password: \"%s\"\n"
"Hostname: \"%s\"\n"
"Port : %s\n"
"Path : \"%s\"\n"
"Extra : \"%s\"\n",
TO_MBS(reUrl.getString(0)),
TO_MBS(reUrl.getString(1)),
TO_MBS(reUrl.getString(2)),
TO_MBS(reUrl.getString(3)),
TO_MBS(reUrl.getString(4)),
reUrl.getString(5),
TO_MBS(reUrl.getString(6)),
TO_MBS(reUrl.getString(7)));
}
while(reUrl.findnext());
Constructor & Destructor Documentation
| Celartem::RegularExpression::RegularExpression |
( |
const UChar1 * |
inPattern, |
|
|
int |
inOptionFlags = regex_default | |
|
) |
| | [inline] |
This method create a RegularExpression instance.
- Parameters:
-
| inPattern | A pattern to search. |
| inOptionFlags | Any combination of RegexOptionFlag enumerations to control the behavior. |
| Celartem::RegularExpression::RegularExpression |
( |
const String & |
inPattern, |
|
|
int |
inOptionFlags = regex_default | |
|
) |
| | [inline] |
This method create a RegularExpression instance.
- Parameters:
-
| inPattern | A pattern to search. |
| inOptionFlags | Any combination of RegexOptionFlag enumerations to control the behavior. |
| Celartem::RegularExpression::RegularExpression |
( |
const utf8s & |
inPattern, |
|
|
int |
inOptionFlags = regex_default | |
|
) |
| | [inline] |
This method create a RegularExpression instance.
- Parameters:
-
| inPattern | A pattern to search. |
| inOptionFlags | Any combination of RegexOptionFlag enumerations to control the behavior. |
Member Function Documentation
| bool Celartem::RegularExpression::findFirst |
( |
const String & |
str |
) |
[inline] |
This method begins a new search in the specified string.
- Parameters:
-
| str | The string on which the new search starts. |
- Returns:
true if at least one matching portion is found, otherwise false.
| bool Celartem::RegularExpression::findFirst |
( |
const UChar1 * |
str, |
|
|
const UChar1 * |
rangePtr = NULL, |
|
|
const UChar1 * |
rangeEnd = NULL, |
|
|
const UChar1 * |
strEnd = NULL | |
|
) |
| | [inline] |
This method begins a new search in the specified string.
- Parameters:
-
| str | A string to do pattern matching on. |
| rangePtr | Pointer to the beginning point of pattern matching. |
| rangeEnd | Pointer to the ending point of pattern matching. |
| strEnd | Pointer to the string end. If this parameter is explicitly specified, then str don't have to be terminated by '\0'. |
- Returns:
true if at least one matching portion is found, otherwise false.
| bool Celartem::RegularExpression::findNext |
( |
|
) |
[inline] |
This method returns the next matching portion if available.
- Returns:
true if at least one more matching portion is found, otherwise false.
| size_t Celartem::RegularExpression::getCount |
( |
|
) |
const [inline] |
This method returns the count of the portions stored in this instance.
- Returns:
- The number of portions in the instance.
| size_t Celartem::RegularExpression::getEndPos |
( |
size_t |
n = 0 |
) |
const [inline] |
This method returns the ending position of the specified portion.
- Parameters:
-
| n | The index of the portion. |
- Returns:
- The ending position.
| size_t Celartem::RegularExpression::getLength |
( |
size_t |
n = 0 |
) |
const [inline] |
This method returns the length of the specified portion.
- Parameters:
-
| n | The index of the portion. |
- Returns:
- The length of the portion string.
| size_t Celartem::RegularExpression::getPos |
( |
size_t |
n = 0 |
) |
const [inline] |
This method returns the beginning position of the specified portion.
- Parameters:
-
| n | The index of the portion. |
- Returns:
- The beginning position.
| const UChar1* Celartem::RegularExpression::getPtr |
( |
size_t |
n = 0 |
) |
const [inline] |
This method returns the pointer to the specified portion.
- Parameters:
-
| n | The index of the portion. |
- Returns:
- Pointer to the specified portion string.
| String Celartem::RegularExpression::getString |
( |
size_t |
n = 0 |
) |
const [inline] |
This method returns the string of the specified portion.
- Parameters:
-
| n | The index of the portion. |
- Returns:
- The string of the portion.
| void Celartem::RegularExpression::init |
( |
const UChar1 * |
inPattern, |
|
|
int |
inOptionFlags = regex_default | |
|
) |
| | [inline] |
This method re-initializes the instance to search another pattern.
- Parameters:
-
| inPattern | A pattern to search. |
| inOptionFlags | Any combination of RegexOptionFlag enumerations to control the behavior. |
Referenced by RegularExpression().
| bool Celartem::RegularExpression::isVaild |
( |
|
) |
const [inline] |
This method verifies whether the last match is valid or not.
- Returns:
true if valid, otherwise false.
The documentation for this class was generated from the following file: