Fix: Accept trailing ">" on search and replace blocks (#4427)

* Modified regex to account for trailing > characters in search and replace blocks

* added check back to other regex's

* Re-ordered regex consts for readability
This commit is contained in:
canvrno
2025-06-25 14:43:26 -07:00
committed by GitHub
parent 5b41cf7af4
commit 090bddbcea
2 changed files with 11 additions and 4 deletions
+6 -4
View File
@@ -8,11 +8,13 @@ const LEGACY_SEARCH_BLOCK_CHAR = "<"
const LEGACY_REPLACE_BLOCK_CHAR = ">"
// Replace the exact string constants with flexible regex patterns
const SEARCH_BLOCK_START_REGEX = /^[-]{3,} SEARCH$/
const SEARCH_BLOCK_START_REGEX = /^[-]{3,} SEARCH>?$/
const LEGACY_SEARCH_BLOCK_START_REGEX = /^[<]{3,} SEARCH>?$/
const SEARCH_BLOCK_END_REGEX = /^[=]{3,}$/
const REPLACE_BLOCK_END_REGEX = /^[+]{3,} REPLACE$/
const LEGACY_SEARCH_BLOCK_START_REGEX = /^[<]{3,} SEARCH$/
const LEGACY_REPLACE_BLOCK_END_REGEX = /^[>]{3,} REPLACE$/
const REPLACE_BLOCK_END_REGEX = /^[+]{3,} REPLACE>?$/
const LEGACY_REPLACE_BLOCK_END_REGEX = /^[>]{3,} REPLACE>?$/
// Helper functions to check if a line matches the flexible patterns
function isSearchBlockStart(line: string): boolean {