Using Regex to replace string in Delphi

From the Official RegularExpressions documentation , there should be a conclusion NUMabcabc. But this is not so. I wonder what's 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.
+4
source share
1 answer

You have the wrong documents. The documents you provided are intended to re-express used when searching for and replacing an IDE. This regular expression flavor is used only by the IDE. The flavor used by the unit RegularExpressionsis PCRE, which is completely different and is documented here .

+4
source

Source: https://habr.com/ru/post/1540737/


All Articles