If I'm not mistaken what you want: {$mode objfpc}{$H+} uses RegExpr; var InputStr: string; r: TRegExpr; begin r:= TRegExpr.Create; try InputStr := ' 28/07/2014 </3604669/trabalho-28-07-2014-pg-1> '; r.Expression := '(\/)([0-9]+)(\/.*?pg\-)(\d+).*?"'; r.Exec(InputStr); WriteLn(r.Substitute('$1$4$3$2')); finally r.Free; end; end.
should do it. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/RegExpr-replace-tp5719987p5719989.html Sent from the Free Pascal - General mailing list archive at Nabble.com. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal