Hello all,
I'd like to replace some part of a string acording to a pattern.
I know how to search and print the matches of a ER:

program test;
{$mode objfpc}{$H+}

uses
regexpr;

var
r: TRegexpr;

BEGIN
r := TRegexpr.create('(\d+)');
try
if r.exec('01 Brazil, 02 USA, 03 China') then
begin
repeat
writeln(r.match[0]);
until not r.ExecNext;
end
else
writeln('Pattern not found');
finally
r.free;
end;
END.

But how could I to substitute all "(\d+)", for example, to "xx".
The regexpr unit has some documentation in its source code, but
dispite this, I was not able to understand how to do it.

-- 
Luciano de Souza
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to