|
Unicorn XML Toolkit Version 1.00.00 |
|||||||||
� PREV CLASS ��NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |
class CRegExp: public CInterface { public: CRegExp(); ~CRegExp(); public: void Create( const CString &strPattern, bool bGlobal, bool bIgnoreCase, bool bMultiline); CString GetSource(); bool GetGlobal(); bool GetIgnoreCase(); bool GetMultiline(); int GetLastIndex(); void SetLastIndex(int nLastIndex); bool Exec(const CString &strInput, CResult &result); bool Test(const CString &strInput); bool Match( const CString &strInput, int nIndex, CResult &result); int Search(const CString &strInput); };
The ECMAScript regular expression.
Regular expressions are created from pattern strings.
Each regular expression has
global
,
ignoreCase
,
multiline
,
and
lastIndex
properties.
The value of the
global
property
is a boolean which indicates whether a global match
is required.
This property corresponds to the property
global
of the ECMAScript
RegExp
instance.
The value of the
ignoreCase
property
is a boolean which indicates whether characters
in the input string must be canonicalized (treated
case-insensitive).
This property corresponds to the property
ignoreCase
of the ECMAScript
RegExp
instance.
The value of the
multiline
property
is a boolean which indicates whether line separators
in the input string require a special treatment.
This property corresponds to the property
multiline
of the ECMAScript
RegExp
instance.
The value of the
lastIndex
property
is an integer that specifies the string position
at which to start the next match.
This property corresponds to the property
lastIndex
of the ECMAScript
RegExp
instance.
See 15.10 RegExp (Regular Expression) Objects in ECMA-262, 3rd Edition for detailed description on how these properties affect the regular expression match algorithms.
CResult
Constructor/Destructor Summary | |
CRegExp
();
����������Constructs the regular expression. |
|
~CRegExp
();
����������Destroys the regular expression. |
Function Summary | |
void
|
Create
(const CString &strPattern, bool bGlobal, bool bIgnoreCase, bool bMultiline);
����������Creates the regular expression from the specified pattern string with specified boolean properties. |
CString
|
GetSource
();
����������Returns a pattern string of this regular expression. |
bool
|
GetGlobal
();
����������Returns a value of the global
property
of this regular expression. |
bool
|
GetIgnoreCase
();
����������Returns a value of the ignoreCase
property
of this regular expression. |
bool
|
GetMultiline
();
����������Returns a value of the multiline
property
of this regular expression. |
int
|
GetLastIndex
();
����������Returns a value of the lastIndex
property of this regular
expression. |
void
|
SetLastIndex
(int nLastIndex);
����������Assigns a new value to the lastIndex
property
of this regular expression |
bool
|
Exec
(const CString &strInput, CResult &result);
����������Executes this regular expression with the specified input string. |
bool
|
Test
(const CString &strInput);
����������Tests the regular expression with the specified input string. |
bool
|
Match
(const CString &strInput, int nIndex, CResult &result);
����������Invokes the matching algorithm associated with this regular expression pattern, passing the specified input string and the specified index as arguments of this algorithm. |
int
|
Search
(const CString &strInput);
����������Searches from the beginning of the input string for a first occurence of this regular expression pattern. |
Constructor/Destructor Detail |
CRegExp();
Constructs the regular expression.
Content of this regular expression remains
unspecified until the member function
Create
is called.
~CRegExp();
Destroys the regular expression.
Function Detail |
void Create( const CString &strPattern, bool bGlobal, bool bIgnoreCase, bool bMultiline);
Creates the regular expression from the specified pattern string with specified boolean properties.
The pattern string must conform to the syntax of Pattern specified in "15.10.1 Patterns" of ECMA-262, 3rd Edition.
The
lastIndex
property is set to
0
.
strPattern
- the pattern stringbGlobal
- the value of the
global
propertybIgnoreCase
- the value of the
ignoreCase
propertybMultiline
- the value of the
multiline
propertyCString GetSource();
Returns a pattern string of this regular expression.
bool GetGlobal();
Returns a value of the
global
property
of this regular expression.
global
property
of this regular expressionbool GetIgnoreCase();
Returns a value of the
ignoreCase
property
of this regular expression.
ignoreCase
property
of this regular expressionbool GetMultiline();
Returns a value of the
multiline
property
of this regular expression.
miltiline
property
of this regular expressionint GetLastIndex();
Returns a value of the
lastIndex
property of this regular
expression.
lastIndex
property
of this regular expressionvoid SetLastIndex(int nLastIndex);
Assigns a new value to the
lastIndex
property
of this regular expression
nLastIndex
- the new value of
the
lastIndex
propertybool Exec(const CString &strInput, CResult &result);
Executes this regular expression with the specified input string.
This function has the semantics similar to that of
exec
function property of the RegExp prototype
specified by ECMA-262.
strInput
- the input stringresult
- on return, the array of captures,
if the match was successful; unspecified if the match failedtrue
if the match was successful;
false
if the match failedbool Test(const CString &strInput);
Tests the regular expression with the specified input string.
This function has the semantics similar to that of
test
function property of the RegExp prototype
specified by ECMA-262.
strInput
- the input stringtrue
if the test was successful,
false
if the test failedbool Match( const CString &strInput, int nIndex, CResult &result);
Invokes the matching algorithm associated with this regular expression pattern, passing the specified input string and the specified index as arguments of this algorithm.
The matching algorithm is described in
15.10.2.2 Pattern of ECMA-262, 3rd Edition;
parameters
strInput
and
nIndex
correspond to str and
index arguments of an internal
closure obtained as the result of evaluation of
the production Pattern::Disjunction.
strInput
- the input stringnIndex
- the indexresult
- on return, the array of captures,
if the match was successful; unspecified if the match failedtrue
if the match was successful;
false
if the match failedint Search(const CString &strInput);
Searches from the beginning of the input string for a first occurence of this regular expression pattern.
This function ignores
global
and
lastIndex
properties of the regular
expression. The
lastIndex
property is left
unchanged.
This function has the semantics similar to that of
search
function property of the String prototype
specified by ECMA-262.
strInput
- the input string-1
if there was no match
|
Unicorn XML Toolkit Version 1.00.00 |
|||||||||
� PREV CLASS ��NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |