program ExtractDoubleQuoteSubstrings;
uses
RegExpr;
var
strValue: string;
regex: TRegExpr;
begin
strValue := 'This is a string with "double-quoted substring1", and "double-quoted substring2" inside.';
// Initialize and configure regex pattern
regex := TRegExpr.Create;
regex.Expression := '"([^"]*)"'; // Regular expression to match substrings within double quotes
// Execute regex search
if regex.Exec(strValue) then
begin
repeat
// Print extracted substring
Writeln(regex.Match[1]);
until not regex.ExecNext;
end;
// Free regex object to prevent memory leaks
regex.Free;
end.
(*
run:
double-quoted substring1
double-quoted substring2
*)