开发者

vim regex to match inline comments

Assuming the following sample inline comment:

/*
function newMethodName (int bar, String s) {
   int i = 123;
}
s/\<foo\s*(/newMethodName (/g
*/

How would I match and replace such that it would, essentially, become uncommented. I got this far before giving up.

:%s/\/\*\(\_.\)*\*\//\1/

Solution

:%s/\/\*\(\开发者_JAVA技巧_.*\)\*\//\1/


Your capture group ( ) is capturing one character or newline. Put the following * inside so that \1 replacement gets the whole string rather than just the first character.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜