正则表达式在代码中查找空注释 [英] Regular expression finding empty comments in code
本文介绍了正则表达式在代码中查找空注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一个正则表达式,只找到空的java注释,如下所示:
i am looking for a regular expression which only finds empty java comments like the following one:
/**
*
*/
Eclipse在以下情况下创建生成一个串行版本ID ...还有另一个 thread 关于查找所有评论但是我没有设法调整正则表达式只是过滤掉空的。
Eclipse creates those when e.g. generating a serial version id... There is another thread about finding all comments however i didn't manage to adapt the regex to only "filter" out the empty ones.
//.*|("(?:\\[^"]|\\"|.)*?")|(?s)/\*.*?\*/
有什么想法吗?
谢谢!
Any ideas? Thanks!
推荐答案
试试这个:
\/\*\*[\s\t\r\n]*[ \*]*[\s\t\r\n]*\*/
应匹配任何以/ **开头的字符串,以*结尾/并且中间只包含换行符,空格或星号。
Should match any string which starts with /**, ends with */ and contains only line breaks, spaces or asterisks in between.
这篇关于正则表达式在代码中查找空注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文