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"));
}
}
¹Ø¼ü´Ê¹ýÂËÎļþ¸ñʽ£º
<?xml version="1.0" encoding="UTF-8"?>
<!--¶¨ÒåÒ»¸ö´æ·Å¹ýÂ˴ʵÄÅäÖÃÎļþ-->
<filterwords>
<!--°´¿ªÍ·Æ¥Åä-->
<beginwith>1,2,3,</beginwith>
<!--°´½áβƥÅä-->
<endwith>4,5,6</endwith>
<!--°´²éÕÒ¶¨Î»Æ¥Åä-->
<indexof>7,8,9</indexof>
<!--°´ÕýÔò±í´ïʽƥÅ䣬ÕýÔò±í´ïʽÀàÐ͵ĹýÂ˴ʽ¨Ò鲻Ҫ̫¶à-->
<regex>123456</regex>
</filterwords>