RegEx.SetExpression |
Top Previous Next |
Syntax function RegEx.SetExpression(RegEx: pointer; Expression: string): boolean
Alternative Names
Description Changes the regular expression.
RegEx is a previously created Regular Expression object by calling RegEx.Create.
The new regular expression is given by the Expression parameter.
Returns TRUE if the expression has been changed.
See also
Example execute udsblock as begin /* create the object, but with an empty expression */ re = RegEx.Create('');
/* set the regular expression */ RegEx.SetExpression(re, '[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+');
try /* find matches in a text */ Res = RegEx.Exec(re, 'test m@nu.nl and then some z@example.com and more, @, test. finally fake@web.com'); while (Res <> __FALSE) do begin /* a match has been found, display it */ email = RegEx.Match(re, 0); GUI.ShowMessage('Found e-mail: ' || email);
/* attempt to find the next match */ Res = RegEx.ExecNext(re); end finally RegEx.Free(re); end end; |