开发者

emacs regexp-builder doesn't work in replace-regexp

I have an emacs buffer contai开发者_StackOverflow社区ning 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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜