removeExtraParenthesis(strToClean): string

Cleans up a given string by removing unnecessary parentheses and replacing specific patterns with placeholders for later restoration. The function processes two types of patterns:

  1. Substrings starting with “FC:”.
  2. Parentheses containing logical operators (“AND” or “OR”).

The function performs the following steps:

  • Identifies and replaces “FC:” patterns with temporary placeholders.
  • Iteratively removes or replaces parentheses based on their content.
  • Restores the replaced placeholders back into the string.

Parameters

ParameterTypeDescription
strToCleanstringThe input string to be cleaned of extra parentheses.

Returns

string

The cleaned string with unnecessary parentheses removed and original patterns restored.

Defined in

src/parsing/parsing-utilities.ts:473