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

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()) {


相关问答:

linux下java调用C++库中函数的问题

不知道是什么原因,我该如何处理,请大虾们指教了,小弟在此谢过。。。。
错误信息如下:
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context t ......

[寻找人才]上海外企·JAVA工程师(内有4个职位)

工作地点:上海张江
学历要求:大本或以上
专业要求:计算机相关专业
英语:熟练(美国项目,英语工作环境,英语是必须)

简历投递:wendy_qian@163.com

MSN:wendydzmm@hotmail.com

......

存储过程如何捕获java出错,然后回滚,不做提交

目前有一个java程序,调用存储过程在数据库中写入一些数据,然后将这些数据传输给另外一个程序,目前不管java连接成功或是不成功,该存储过程都会写入数据!
目前需要在java连接不成功的情况下,有何方法能使存储过程 ......

java中的疑问

1  public class BirthDate {
2 private int day;
3 private int month;
4 private int year;
5
6 public BirthDate (){}
7
8 public BirthDate (int d,int m,int y){
9 day = d;
......

java语法问题 - Java / Java EE

import java.io.*;
class FileTest
{
public static void main(String [] args) throws Exception
{

File fDir=new File(File.separator);
String strFile="java源代码测试"+File.separato ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号