Eclipse的搜索和替换中的匹配组语法是什么? [英] What is the match group syntax in Eclipse's search and replace

查看:134
本文介绍了Eclipse的搜索和替换中的匹配组语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在vi上执行搜索/替换的语法是什么?

%s / log(。*)/ log \1 debug / g



行如下:

 日志消息

替换为

 日志消息调试

搜索/替换对话框中的eclipse的正确语法是什么(旁边查看正则表达式)



谢谢。

解决方案

使用$ 1而不是\1



对于/ g全局替换标志,请使用全部替换按钮:





注意:以上是单个文件的查找/替换对话框,出现在Ctrl-F



为跨多个文件工作,默认快捷方式是Ctrl-H,对话框有点不同:




What's the syntax to perform a search/replace on Eclipse and use "match groups" ( is that it's name? "

On vi I:

%s/log(.*)/log \1 debug/g

And lines like:

log "Message" 

are replaced with

log "Message" debug

What's the correct syntax for eclipse in the search/replace dialog box ( beside checking up "Regular expressions" )

Thanks.

解决方案

Use $1 instead of \1

For the /g global replace flag, use the Replace All button:

Note: The above is the Find/Replace dialog for a single file, comes up for Ctrl-F

For working across multiple files, default shortcut is Ctrl-H, and the dialogs are a bit different:

这篇关于Eclipse的搜索和替换中的匹配组语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆