Description | Hierarchy | Fields | Methods | Properties |
type unaRegExp = class(unaObject)
RegExp utility class.
constructor create(const regexp: wString); |
|
destructor Destroy(); override; |
|
function match(out len: int; const subject: wString = ''; startFrom: int = -1): int; overload; |
|
function match(const subject: wString = ''; startFrom: int = -1): wString; overload; |
|
function replace(const substitution: wString; const subject: wString = ''; startFrom: int = -1; global: bool = false): string; |
property error: int read f_error; |
|
property lookupPos: int read f_lookupPos write f_lookupPos; |
|
property regexp: wString read f_regexp write setRegexp; |
|
property subj: wString read f_subj write setSubj; |
constructor create(const regexp: wString); |
|
Creates a new class for regexp. |
destructor Destroy(); override; |
|
Releases regexp resources. |
function match(out len: int; const subject: wString = ''; startFrom: int = -1): int; overload; |
|
Returns first match position and length. Updates lookupPos property if match was found, new non-empty subject was specified or startFrom was specified. Also updates subj property if new non-empty subject was specified.
Parameters
Returnsfirst match position, 0 if no match was found or one of unaRE_error_XXX if regexp is incorrect |
function match(const subject: wString = ''; startFrom: int = -1): wString; overload; |
|
Returns first match. Updates lookupPos property if new non-empty subject was specified or match was found. Also updates subj property if new non-empty subject was specified.
Parameters
Returnsfirst match or empty string if no match found |
function replace(const substitution: wString; const subject: wString = ''; startFrom: int = -1; global: bool = false): string; |
|
Replaces first or all matches with substitution, which can also include backrefs.
Parameters
Returnsresulting string |
property error: int read f_error; |
|
Regexp error code, unaRE_error_OK means no error |
property lookupPos: int read f_lookupPos write f_lookupPos; |
|
Starting position for a lookup. |
property regexp: wString read f_regexp write setRegexp; |
|
Regexp to use. |
property subj: wString read f_subj write setSubj; |
|
Subject to use. |
(c) 2012 Lake of Soft