bug#81555: 30.2; The regular expression parser used by replace-regexp is not escaping certain characters

Arash Esbati <[email protected]> Wed, 05 Aug 2026 10:10:34 +0200
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
gargoles via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]> writes:

> Some characters cannot be escaped on the regular expression provided to
> replace-regexp. I'm unaware if this is due to some limitation or
> implementation specific quirk.
>
> ** STEPS TO REPRODUCE
>
> 1. Start Emacs through: runemacs.exe -Q
>
> 2. Paste the following text into the scratch buffer:
>
>   Text sample (100)
>   Text sample (200) #Information
>   Text sample (300)
>
> 3. Move the cursor to the begginning of the text (on the 'T' of the first
> "Text" in this case).
>
> 4. Run the replace-regexp function through C-M-% (The exact same error
> occurs when running M-x replace-regexp)
>
> 5. Enter the following string as the regular expression and press RET:
>    \(.*$
>    Also tested with:
>    \).*$
>    with the same results.

Maybe I'm missing the point, but do you get the expected result if you
enter:

  (.*$

and press RET (Note the missing \)?

Best, Arash