## TASK: Create a JSON file for code replacements

You need to create a JSON file that specifies exact code changes. This tool will find and replace code snippets based on your JSON specification.

### JSON FORMAT REQUIRED:
```json
{
  "changes": [
    {
      "find": "exact code to find including all whitespace and indentation",
      "replace": "exact replacement code with proper formatting"
    }
  ]
}
```

### CRITICAL RULES FOR SUCCESS:

1.  **EXACT MATCHING IS REQUIRED**
    -   Copy the EXACT code from the source file character-by-character.
    -   Include ALL whitespace, tabs, spaces, and newlines exactly as they appear.
    -   The tool will FAIL if even one space or newline is different.

2.  **MAKING YOUR MATCHES UNIQUE**
    -   Your `find` value must be unique and appear only **once** in the entire file.
    -   If the code appears multiple times, include more surrounding context to ensure uniqueness.
    -   For common patterns (like `}` or `return`), always include surrounding lines.

3.  **PROCESSING LOGIC**
    -   All `find` operations are performed on the original source file *before* any changes are made.
    -   This means one replacement will not affect the `find` operation for another.
    -   **CRITICAL:** Your `find` patterns **must not overlap**. For example, you cannot have one change that finds lines 10-12 and another that finds lines 12-14.

4.  **JSON ESCAPING RULES**
    -   Backslashes: `\` → `\\`
    -   Quotes: `"` → `\"`
    -   Newlines: Use `\n` for line breaks
    -   Tabs: Use `\t` or match the file's space convention

5.  **ADDING NEW FEATURES/FUNCTIONS**
    To add a new function, find a strategic location (like after an existing function) and replace a small, unique section with a larger section that includes your new code.
    - Example: Replace a closing brace with your new function + the closing brace:
   ```json
   {
     "changes": [
        {
          "find": "}\n\n// End of file comment",
          "replace": "}\n\nfunction newFeature() {\n    // New code here\n}\n\n// End of file comment"
        }
     ]
   }
   ```

### DEBUGGING FAILED REPLACEMENTS:

-   **"Pattern not found"**: Copy the EXACT text again. Check for tab vs. space differences, invisible trailing spaces, or newline character differences (CRLF vs. LF).
-   **"Pattern found X times (ambiguous)"**: Add more context lines before and after your `find` value to make it unique.
-   **"Overlapping Match Error"**: Your `find` values for two different changes are trying to modify the same lines of code. Adjust them so they are distinct and do not overlap.

Remember: **Precision and Uniqueness are key.** The tool performs exact string matching.

PLOTCAT Replacer

Version 0.59

Input File

No file selected

JSON Changes

No file selected

Result

Processing Errors