奇怪的正则表达式!在线等解答
public static void main(String[] args){
String tmp= " <div> \n ";
tmp+= "adfasfdf\n ";
tmp+= "adfasf\n ";
tmp+= " </div> ";
RE re = new RE( " <div> (.|\r|\n)+ </div> ");
for(int i=0;i <re.getParenCount();i++){
System.out.println(i+ "--- "+re.getParen(i));
}
}
我想取出div标记中间的内容,但不成功,不知道错在哪里,当然这是一个简化过的,实际比这个内容复杂.
------解决方案--------------------RE re = new RE( " <div> ([^ <]+) </div> ")
------解决方案--------------------RE re = new RE( " <div> ((.|[\\n])*) </div> ");