[fpc-pascal] Replacing parts of a string with TRegexpr
luciano de souza
luchyanus at gmail.com
Thu Feb 22 14:38:58 CET 2018
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:
r := TRegexpr.create('(\d+)');
if r.exec('01 Brazil, 02 USA, 03 China') then
until not r.ExecNext;
writeln('Pattern not found');
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
More information about the fpc-pascal