I have an emacs buffer containing the text
a1b2c3
using the regexp-builder, i create the regexp
"b\\(2\\)"
and can see the match highlighting (b2, with the 2 in a different colour).
however, when i paste the expression into replace-regexp, i get 0 matches. both with and without the quotes. to get a match i need to use
b\(2\)
i guess there’s some escaping going on here, but surely i must be doing something wrong. having to manually escape seems to defeat half the point.
regexp-buildercan show the regexp in several syntaxes. By default, it uses the syntax that is appropriate to put in an Emacs Lisp source (readsyntax), so the regexp is placed between double quotes and every backslash is doubled. For interactive use, select thestringsyntax withC-c C-i(reb-change-syntax).