请问这个正则表达式怎么写? 如题,需要把以下字符串替换成"\r\n]",即一个换行加中括号"]",请问该怎么写?最好能够讲解一下,鄙人对正则表达式不太精通,不尽感谢。,{ xtype:'tbseparator', width:10, height:17},] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 replace(",\\r\\n{\\r\\n\\s*xtype:'tbseparator',\\r\\n\\s*width:10,\\r\\n\\s*height:17},","") xtype:'tbseparator', width:10, height:17这一段是可以变化的吧,,只是具有xxxx:'xxxx'这样的格式对吗? 这段字符串里面有很多个形如{ xtype:'tbseparator', width:10, height:17}的子字符串,我只需要把不用的替换掉,所以不能去掉空格 你这需求最好用javascript 处理,"\r\n"变"\r\n]" 只一 replace 就可了:// import java.util.*;public class Test1{ public static void main(String args[]){ String str=",\r\n{\r\n xtype:'tbseparator',\r\n width:10,"; // height:17// },// ] str=str.replaceAll("\r\n", "\r\n]"); System.out.println(str); }} 变量赋值问题 写linux shell脚本,在几千台服务器上装jdk和tomcat 关于构造方法的重载问题 java 关于停止按钮的实现 j2se中SWT高手请进! MaxLength = rs.getInt(3)老出错? [闭月羞花猫]这两天怎么这么忙? image , bufferedImage , graphics 之间的关系 JBOSS中怎样配置Oracle8i的数据源? 又一个数据库的问题 我用exe4j将java变exe,再用inno安装生成安装包,安装之后,打开程序却弹出这东西,是什么原因,求解决? 为什么JToolBar上按钮的文字不能显示? 求助一个极其简单的问题
},","")
width:10,
height:17
这一段是可以变化的吧,,只是具有xxxx:'xxxx'这样的格式对吗?
{
xtype:'tbseparator',
width:10,
height:17
}的子字符串,我只需要把不用的替换掉,所以不能去掉空格
// import java.util.*;public class Test1{
public static void main(String args[]){
String str=",\r\n{\r\n xtype:'tbseparator',\r\n width:10,"; // height:17
// },
// ]
str=str.replaceAll("\r\n", "\r\n]");
System.out.println(str);
}
}