Java正則備忘(附正則表達式查詢表)

[color=blue][size=x-large]A sample:[/size][/color]
[img]http://dl.iteye.com/upload/attachment/222480/7337b05e-6d43-3c8e-8b34-f4806278d7a1.png[/img]

/**
* description: 取出上圖中的單詞列表,其他沒用的就不要了<br>
* @param args
* Mar 22, 2010
* @author huxiao [email protected]
*/
public static void main(String[] args) {
String testString = "String(fjsi fj\"this is my target word\"lsd jflks)";
Matcher matcher = Pattern.compile("w\\(\\d+,\"[^\"]+\",\"([^\"]+)\"").matcher(testString);
if(matcher.find()){
System.out.println(matcher.group(1));
}
}


------------------------------------------------------------


[color=blue][size=x-large]正則表達式查詢表:[/size][/color]

[img]http://dl.iteye.com/upload/attachment/222472/b9c2e99b-c0e0-31f9-b94f-05b087b6da03.jpg[/img]
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章