I used the HYPERSTR library for string processing. Now I am using the new Delphi. I need to find a pattern in a string, for example, the old function function IsMatchEx(const Source, Search:AnsiString; var Start:integer) : Integer; . Actually, I donβt need the value of the result, I just want to know if the template matches 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 donβt understand how to use it.
This code does not return TRUE:
if TRegEx.IsMatch('abcdef', 'abcd?f') then showmessage('match');
I also got the same result when using MatchesMask .
Thanks.
source share