易截截图软件、单文件、免安装、纯绿色、仅160KB

JAVA 正则问题

Java code:

String compile="<.+?>";
String str="<a href='asdasd'>hahah</a>";
Pattern p = Pattern.compile(compile);
Matcher m = p.matcher(str);
while(m.find()){
//if(m.matches())
System.out.println(m.group());
}


这是把正则匹配的东西输出
我要把正则匹配的东西过滤掉,该怎么输出,

用分组啊
Java code:
String compile="<.+?>(.*?)</.+?>";
String str="<a href='asdasd'>hahah</a>";
Pattern p = Pattern.compile(compile);
Matcher m = p.matcher(str);
while(m.find()){
//if(m.matches())
System.out.println(m.group(1));
}




相关问答:

java怎么连接Oracle,急啊 - Java / Java相关

private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "s ......

jsp页面中字体变色问题 - Java / Web 开发

<html><head><title>[@title]</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<script language='javascript'>
function diyCheck ......

eclipse java 控制台 - Java / Java SE

怎么在控制台中输入类似下面的信息:
 s1234 50  
  s1235 80  
  s1234 90  
  s1234 40  
  s1236 90  
每当回车时 ......

mysql连接tomcat - Java / Web 开发

我已经按照教程上配置tomcat的server.xml
<Context path = "/POS" docBase = "POS" debug = "5" reloadable = "true" crossContext = "true" workDir = &quo ......

java xml文题 - Java / Java SE

<?xml version="1.0" encoding="utf-8" ?> 
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical&q ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号