Posted on 2010-04-21 12:30
leekiang 閱讀(274)
評論(0) 編輯 收藏 所屬分類:
java 、
文件處理
String regex = "<a.*?/a>";//取鏈接
?? ??? ?Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
?? ??? ?Matcher mt = pattern.matcher(str);
?? ??? ?while (mt.find()) {
?? ??? ?String s=mt.group();
?? ??? ?}
?? ???? String regex2 = ">.*?</a>";// 標題部分
?? ???? String regex3 = "imgs/[([0-9])]+.(jpg|gif|png|bmp)";//取圖片
輸入例子可產生正則表達式
http://sourceforge.net/projects/quickrex/
在線測試
http://www.fileformat.info/tool/regex.htm