diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index b9ad0099..7f14cec6 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -2538,15 +2538,17 @@ namespace VEPROMS.CSLA.Library return text; } // B2022-015 BNPPalr: Determine whether RO text should have Replace Words applied + // B2022-022 BNPP needed to add use of 'offset' to work with string. 'offset' is used in code to keep track + // of offset in text in case other replacements are made before the current, i.e. adjusts the index found in the Match. private bool VerifyWithinLink(string text, FoundMatch foundMatch, int offset) { // Is Match within a link, i.e. between a start & end and has '#Link:R' (defined referenced object link) between them too - int sindx = text.LastIndexOf(" -1) { int eindx = text.IndexOf("[END>",sindx + 1); bool isRo = eindx > sindx && text.Substring(sindx, eindx - sindx - 1).Contains("#Link:R"); - if (isRo && foundMatch.MyMatch.Index > sindx && foundMatch.MyMatch.Index < eindx) return true; + if (isRo && foundMatch.MyMatch.Index + offset > sindx && foundMatch.MyMatch.Index + offset < eindx) return true; // B2022-022 added offset } return false; }