Reputation: 3852
From Official documentation of RegularExpressions, the output should be NUMabcabc
. But it is not. I wonder what is wrong ?
program Project128;
{$APPTYPE CONSOLE}
uses RegularExpressions;
var Regex: TRegEx;
begin
Regex := TRegEx.Create('{[0-9]}{[a-c]*}');
WriteLn(Regex.Replace('3abcabc', 'NUM\1'));
ReadLn;
end.
Upvotes: 4
Views: 2073
Reputation: 1622
To got the RegEx as the IDE results
with TRegEx.Create1('([0-9])([a-c]*)') do
writeln(Replace('3abcabc', 'NUM\2'));
Upvotes: 1
Reputation: 613562
You've got the wrong docs. The docs you reference are for the regex flavour used by IDE search and replace. That flavour of regex is just used by the IDE. The flavour used by the RegularExpressions
unit is PCRE, which is quite different and is documented here.
Upvotes: 4