I have a problem when I use TRegEx with a case insensitive Regex string. The Regex does not match anything.
My regex:
'/stream_map=(.[^&]*?)&/i'
source:
procedure TForm1.Button1Click(Sender: TObject);
var
regex : TRegEx;
exper : string;
fmatch : TMatchCollection;
example: string;
begin
example := 'Stream_Map=TestMatch&'
exper := '/stream_map=(.[^&]*?)&/i';
regex := TRegEx.Create(exper);
fmatch := regex.Matches(example);
ShowMessage(IntToStr(fmatch.Count));
end;
The matches count shows "0" .
It looks to me as though you are using the wrong syntax for your regex.
looks like Perl regex syntax.
For Delphi’s
TRegExyou need to remove the slash delimiters and specify case insensitivity through an options parameter. Like this: