I'm writing a little cleanup function that will search for the word 'let' in a case insensitive manner then replace it with the lowercase 'let'. It works in all my test cases, except for when the first letter is capitalized:
leT x=1
Let y=2
let z=3
lEt a=3
In the output, the second line is wrong:
let x=1
Let y=2
let z=3
let a=3
Here's the elisp:
(defun let-cmd()
(goto-char (point-min))
(while (search-forward-regexp "Let" nil t)
(replace-match "let" (match-string 1)) t nil))
(defun cleanup()
(interactive)
(let-cmd))
How do I fix this one example?