Strip BOM before matching (LLM won't include invisible BOM in oldText), restore on write. Based on #394 by @prathamdby