I assume that the Regex dialect used in Delphi's System.RegularExpressions is PCRE. (I use Delphi Rio 10.3.3)
RegexBuddy gives me a warning with this Regex (when using PCRE):
(?<!('.*))\{.*?\}
The PCRE library does not support variable repetition inside lookbehind
This is a sample data I am trying to match:
ThisString := ' ab{comment inside a string}yz ';
Is there any way to use variable repetition inside lookbehind in a Regex in Delphi Rio 10.3.3?
In PCRE (and in Delphi which uses PCRE) you can use \K
to work around the limitations of lookbehind. The regex in your question can be rewritten like this:
(?m)(^|\G)[^'\v]*?\K\{.*?\}
RegexBuddy 4.10.0 fully supports Delphi 10.3. There's no difference in the regex support between 10.3.0 and 10.3.3.
If you're trying to match strings and comments in Delphi, you're better of with a straightforward regex that matches them separately. This regex has 3 separate alternatives to match a string, comment, or alternate comment:
(?<string>'[^'\v]*+')|(?<comment>\{[^}]*+\})|(?<altcomment>(?m)\(\*.*?\*\))
Write some Delphi code to iterate over the matches of this regex and process or skip the match as a string, comment, or alternate comment based on which of the 3 capturing groups matched.