Professional Documents
Culture Documents
A Regular Expression is a string that describes a target text by defining the features that the target text must posses ex: the target text must start with a lower case letter, followed by 1 to 3 digits, and it must be terminated by a dot: ^[a- z]\d{1,3}.*\.$
Syntax
interface IRegExp2 + + + + + + + Pattern: WideString IgnoreCase: WordBool Global: WordBool Multiline: WordBool Execute(WideString) : IDispatch Test(WideString) : WordBool Replace(WideString, WideString) : WideString interface IMatchCollection2 + + + Item[]: IDispatch Count: Integer _NewEnum: IUnknown + + + + interface IMatch2 Value: WideString FirstIndex: Integer Length: Integer SubMatches: IDispatch
coclass CoRegExp
+ + +
interface IRegex + + + + + + + + Pattern: W ideString IgnoreCase: Boolean MultiLine: Boolean Match(WideString) : Boolean Find(WideString) : IMatchCollection FindAll(WideString) : IMatchCollection Replace(WideString, WideString) : WideString ReplaceAll(WideString, WideString) : WideString interface IMatchCollection + + Count: Integer Item[]: IMatch + + + + interface IMatch Value: W ideString FirstIndex: Integer Length: Integer SubMatches: ISubMatches
+ + + + + +
Create(W ideString, TRegexOptions) : IRegex Match(W ideString, W ideString) : Boolean Find(W ideString, W ideString) : IMatchCollection FindAll(W ideString, W ideString) : IMatchCollection Replace(W ideString, W ideString) : W ideString ReplaceAll(W ideString, W ideString) : W ideString
delphi interface IRegex + + + + + Match() : Boolean Matches() : IMatchCollection Grep() Split() : IStringCollection Replace() : string
delphi interface ICaptureGroupCollection + Count: Integer + default 0..* + + + 1..* +CaptureGroups[] Items[]
delphi interface ICaptureGroup Success: Boolean Value: string Index: Integer Length: Integer
delphi interface IRegexInfo + + CompiledSize: Integer CaptureCount: Integer + delphi interface IMatchCollection Count: Integer + default 0..* + + + Items[] delphi interface IMatch Success: Boolean Value: string Index: Integer Length: Integer
string
References
Books
P Jeffrey E. F. Friedl - Mastering Regular Expressions (2nd edition) - OReilly P Tony Stubblebine - Regular Expression Pocket Reference - OReilly
Web
P http://www.pcre.org - PCRE P http://msdn.microsoft.com/library - VBScript RegExp docs & .NET Regex docs P http://www.boost.org/libs/regex/doc/index.html boost.regex documentation [C++](John Maddock) P http://www.renatomancuso.com - Delphi wrappers for PCRE and VBScript RegExp
mancuso@renatomancuso.com