https://blog.csdn.net/weixin_43732798/article/details/100067094
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main3 {
public static void main(String[] args) throws IOException {
String filePath = "./src/Main3.java";
String jsContent = new String(Files.readAllBytes(Paths.get(filePath)));
Pattern p=Pattern.compile("/\\*.*?\\*/",Pattern.MULTILINE|Pattern.DOTALL);
Matcher m=p.matcher(jsContent);
while(m.find()){
System.out.println(m.group()+" 位置:["+m.start()+","+m.end()+"]");
}
}
}