博客园
博客园
首页
博问
闪存
新随笔
联系
订阅
管理
随笔- 132 文章- 0 评论- 10
2009年4月9日
My JavaRegularExpressionUtil
Code
import
java.util.
*
;
import
java.util.regex.
*
;
public
class
JavaRegularExpressionUtil {
public
static
ArrayList
<
String
>
findMatches(String input, String expression) {
ArrayList
<
String
>
matches
=
new
ArrayList
<
String
>
();
Pattern pattern
=
Pattern.compile(expression);
Matcher matcher
=
pattern.matcher(input);
while
(matcher.find()) {
matches.add(matcher.group());
}
return
matches;
}
}
posted @ 2009-04-09 07:22 N/A2011 阅读(42) 评论(0)
编辑
公告