LPS-45109 Apply the same logic to stripBetween