A user of my application has created
a regluar _expression_ that causes errors when my app calls
TDIPerlRegEx.Format. The errors include index out of range, access
violation, and
invalid pointer errors. The problem seems to be related to the following subject, match pattern and format pattern: Subject String: That afternoon, then Dow Jones C.E.O. Rich Zannino Came down From the executive 11th floor to the newsroom to address the staff about the morning’s announcement. Match Pattern: (?-i)[\[\(]?([A-Z])\.([A-Z])\.([B-Z])\.([\'\x92]s)?[\]\)]?(?i)[\s]((?-i)[A-Z](?i)[a-z]{1,14})([\'\x92]s)?[\]\)]?([\p{Po}\p{Pf}])? Format Pattern: <s> $1 $2 $3$4 $5$6$7 In the following code, the above subject, match pattern and format pattern are placed in memo1, memo1 and memo3. The call to RE.Match succeeds, and RE.Format raises an access violation: procedure TForm1.Button1Click(Sender: TObject); var RE: TDIPerlRegEx; begin RE := nil; try try RE := TDIPerlRegEx.Create(Self); RE.SetSubjectStr(Trim(Memo1.Text)); RE.CompileMatchPattern(Trim(Memo2.Text)); RE.FormatPattern := Trim(Memo3.Text); If RE.Match > 0 then ShowMessage(RE.Format); except on E:Exception do ShowMessage(E.Message); end; finally If Assigned(RE) then FreeAndNil(RE); end; end; Sample project (Delphi 7) is attached. Any idea what the problem could be? Thanks Jim |