On Sun, Sep 7, 2014 at 9:36 AM, leledumbo <leledumbo_c...@yahoo.co.id> wrote: > > 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.
UAU! Didn't worked but you gave me the answer because this worked: {$mode objfpc}{$H+} uses RegExpr; var InputStr: string; r: TRegExpr; begin r:= TRegExpr.Create; try InputStr := '<a href="/3604669/trabalho-28-07-2014-pg-1" title="Página 1, pg 1, 28/07/2014"> 28/07/2014 </a>'; r.Expression := '(\/)([0-9]+)(\/.*?pg\-)(\d+)(.*?)"'; r.Exec(InputStr); ShowMessage(r.Substitute('$1#p1$3#p2$5')); finally r.Free; end; end; I finished this task yesterday making a new method for my own TRegExpr but your tip is more elegant, thank you! -- Marcos Douglas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal