RegEx.Replace2 |
Top Previous Next |
Syntax function RegEx.Replace2(RegEx: pointer; InputStr: string; ReplaceStr: string; Substitute: boolean): string
Alternative Names
Description Replaces all matches with the given replacement.
RegEx is a previously created Regular Expression object by calling RegEx.Create.
InputStr is the text that will be searches for matches and ReplaceStr is the text to replace matches with. The Regular Expression object text will be set to the InputStr.
If Substitute is TRUE, the Regular Expression object will have its search text replaced with the text returned.
Returns the text with any matches replaced.
An easier way of replacing all matches is RegEx.ReplaceMatches.
See also
Example execute udsblock as begin re = RegEx.Create('[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+'); try resulttxt = RegEx.Replace(re, 'test m@nu.nl and then some z@example.com and more, @, test. finally fake@web.com', '$0 is the e-mail found'); GUI.ShowMessage(resulttxt);
resulttxt = RegEx.Replace2(re, 'test m@nu.nl and then some z@example.com and more, @, test. finally fake@web.com', 'nospam@example.com', 1); GUI.ShowMessage(resulttxt); finally RegEx.Free(re); end end; |