Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure RegExMatchAll(Pattern: String; Subject: String; out Matches: TMatches);
- var D, sD: integer; RegEx: TRegEx; RegGroupColl: TGroupCollection; RegColl: TMatchCollection;
- begin
- RegEx := TRegEx.Create(Pattern);
- RegColl := RegEx.Matches(Subject);
- SetLength(Matches, RegColl.Count); // Numero de coincidencias [array [X]]
- for D := 0 to RegColl.Count - 1 do begin
- RegGroupColl := RegColl.Item[D].Groups;
- SetLength(Matches[D], RegGroupColl.Count); // Numero de grupos [array [D][sD]]
- for sD := 0 to RegGroupColl.Count - 1 do Matches[D][sD] := RegGroupColl.Item[sD].Value;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment