## Lesson — When parsing shell scripts to replace code blocks,

**Tags:** shell, regex, git-hooks

When parsing shell scripts to replace code blocks, searching for the 'fi' keyword can prematurely match nested conditionals and truncate the block. Use global matching or specific end-of-block markers to ensure the entire outer conditional is captured.
