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-builder
can show the regexp in several syntaxes. By default, it uses the syntax that is appropriate to put in an Emacs Lisp source (read
syntax), so the regexp is placed between double quotes and every backslash is doubled. For interactive use, select the string
syntax with C-c C-i
(reb-change-syntax
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With