I used to use HYPERSTR library for string processing routine. Now I use newer Delphi. I need to search a pattern in a string, for example the old function is function IsMatchEx(const Source, Search:AnsiString; var Start:integer) : Integer;
. Actually I don't need the result value, I just wanna know if the pattern match with the string or not.
My old code (returns TRUE):
var
StartPos: integer;
FoundPos: integer;
begin
StartPos := 1;
FoundPos := IsMatchEx('abcdef', 'abcd?f', StartPos);
if FoundPos > 0 then
showmessage('match');
end;
I see that Delphi XE has TRegEx but I stil don't understand to use it.
These code doesn't return TRUE :
if TRegEx.IsMatch('abcdef', 'abcd?f') then
showmessage('match');
I also got same result when using MatchesMask
.
Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With