You try using unQuoteChar inside TRegExpr.Substitute, so using unQuoteChar on template sometimes fail on if APtr >= fRegexEnd for example with error Error(reeNoHexCodeAfterBSlashX);
just because fRegexEnd doesn't have nothing in common with passed template.
proposed fix:
function TRegExpr.UnQuoteChar(var APtr: PRegExprChar; var pEnd: PRegExprChar): REChar;
and pass fRegexEnd or TemplateEnd and check for pEnd
You try using unQuoteChar inside TRegExpr.Substitute, so using unQuoteChar on template sometimes fail on if APtr >= fRegexEnd for example with error Error(reeNoHexCodeAfterBSlashX); just because fRegexEnd doesn't have nothing in common with passed template.
proposed fix: function TRegExpr.UnQuoteChar(var APtr: PRegExprChar; var pEnd: PRegExprChar): REChar;
and pass fRegexEnd or TemplateEnd and check for pEnd