用于字符串内容提取。
import java.util.regex.*;
public class MyDemo {
public static void main(String[] args) {
String str = "[img]http://xxxxx.com/xxxx1.jpg[/img]" +
"[img]http://xxxxx.com/xxxx2.jpg [/img]" +
"[img]http://xxxxx.com/xxxx3.jpg [/img]" +
"[img]http://xxxxx.com/xxxx4.jpg [/img]" +
"[img]http://xxxxx.com/xxxx5.jpg [/img]" +
"[img]http://xxxxx.com/xxxx6.jpg [/img]";
System.out.println(str.replaceAll("\\[img](.*?)\\[/img]", "$1\n"));
}
}
归类于: java code util — lizongbo @ 1:58 pm 评论(1)
相关正则太多了,有没有从html表格里提取内容写进数据库的
http://www.123goo.com站长
123goo —— 2006年02月19日 @4:45 pm