====== TRegExpr ====== ===== Exemple d'utilisation ===== procedure TMainForm.RegExecute(ARegex, AText: string); var vReg: TRegExpr; vI: integer; begin MMRes.Clear; vReg := TRegExpr.Create(ARegex); try if vReg.Exec(AText) then begin repeat MMRes.Lines.add('RegExpr.SubExprMatchCount=%d', [vReg.SubExprMatchCount]); if vReg.SubExprMatchCount > 0 then begin for vI := 0 to vReg.SubExprMatchCount do begin MMRes.Lines.add(''); // ligne vide MMRes.Lines.add('RegExpr.Match[%d]=''%s''', [vI, vReg.Match[vI]]); MMRes.Lines.add('RegExpr.MatchPos[%d]=%d', [vI, vReg.MatchPos[vI]]); MMRes.Lines.add('RegExpr.MatchLen[%d]=%d', [vI, vReg.MatchLen[vI]]); end; end; until not vReg.ExecNext; end; finally vReg.Free; end; end; ===== Sources & Ressources ===== * [[https://rchastain.developpez.com/tutoriel/pascal/expressions-regulieres/|Expressions régulières avec l'unité RegExpr de Free Pascal @ Developpez.com]] * [[https://regex101.com/|REGEX101.COM un testeur d'expressions régulières]]