java中匹配/* explanation */的正则表达式怎么写? java中匹配/* explanation */的正则表达式怎么写? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String str = "/* asfdasfdsaf */ /*asdfasdfsadfdsaf*dsa/asdfasf*/aaa"; String regex = "/\\*/?(\\n|[^/]|[^*]/)*\\*/"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(str); if (m.find()) { String matchstr = m.group(); System.out.println(matchstr); } 如果是这样的数据,你想得到什么?String str = "this is a comments /* test */ comments"; /* test2 */ 将一个正整数分解质因数 socket.isConnected 怎么经常说找不到符号啊? 大哥们 进来帮我看一下 关于JDK1.6配制出现的问题 谁来帮我讲解一下这道题~~~谢谢 tomcat6的用法 如何改变文本框的输入方式 超级菜鸟!java怎么写 x^y,x的y次方? 祝大家新年快乐,散分200!哈哈! RSAPublicKey 的一个问题,我怎么想都不对劲啊,求教 java出现过多少次的笨办法
String regex = "/\\*/?(\\n|[^/]|[^*]/)*\\*/";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str); if (m.find()) {
String matchstr = m.group();
System.out.println(matchstr);
}