Java 正则的书写
Java正则表达式。 Pattern p2 = Pattern.compile(" <a.*>"); Matcher m2 =p2.matcher(ss); 如何把 类似与 <a href="xxxxx.html">Lakers </a>的标签给替换掉呀? 把 <a href="xxxxx.html"> 替换掉,或者把 <a href="xxxxx.html"> </a>。我需要的是Lakers 这个数据。 这样是不行的 <a.*>。
引用 Java codepublicclass Test {publicstaticvoid main(String[] args) { String str=" <a href=\"xxxxx.html\">Lakers </a>"; str= str.replaceAll(" </?(?i:a)[^>]*>",""); System.out.println(str); } } 很好,让我进一步学习了问号的用法 佩服,学习了。 学习 呵呵 ,多谢大家 了 。 Java code: import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexTest { public static void main(String[] args) { String str = "<a href=\"xxxxx.html\">Lakers</a>"; Pattern pattern = Pattern.compile("(?<=\\>)\\w+(?=\\</)"); Matcher m = pattern.matcher(str); if(m.find()) {
相关问答:
不知道是什么原因,我该如何处理,请大虾们指教了,小弟在此谢过。。。。 错误信息如下: The program being debugged was signaled while in a function called from GDB. GDB has restored the context t ......
字符流的读和写最终在底层都是通过字节流来完成的吗? 读写文本文件字符流应该就可以了吧。。 各位大哥大姐帮帮忙阿 Java流包括字节流和字符流,字节流通过IO设备以字节数据的方式读入,而字符流则是通过字节流 ......
查API,看到FeatrueFactory有这个方法 public Feature createPolyLine(double[][] thePoints, R ......
我在eclipse中写了一个播放音乐的类,并把音乐文件和类文件放在了一起,结果运行时,出现错误,说是音乐文件那个是空的,但是在jcreator用同样的方法结果是可以运行的,请求高说指教,告诉为什么?急 你若是在Windo ......
如题。 遥遥无期啊,买房难啊 22世纪吧,,, 明天就可以,但是明天永远是明天啊!!!! 买房?不是it民工想的。 加油吧~`` 我觉得也是 房自己随便盖一个既是.... 买咱是别想了 ......