facebook twitter hatena line email

「Java/正規表現」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「==ヒットする文字列をすべて取得== Pattern pattern = Pattern.compile("(http://example.com/img/[0-9a-z-]+/mobile/[0-9]+_128x128.jpg)"); Matcher matcher = pat...」)
(相違点なし)

2015年5月20日 (水) 03:18時点における版

ヒットする文字列をすべて取得

Pattern pattern = Pattern.compile("(http://example.com/img/[0-9a-z-]+/mobile/[0-9]+_128x128.jpg)");
Matcher matcher = pattern.matcher(html);
// 検索ヒット
while (matcher.find()) {
    Log.d("tag1", "url=" + matcher.group(1));
}