Regular expression finding empty comments in code
问题 i am looking for a regular expression which only finds empty java comments like the following one: /** * */ 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! 回答1: Try this: \/\*\*[\s\t\r\n]*[ \*]*[\s\t\r\n]*\*/ Should match any string which starts with /**, ends with */ and contains only