JAVA開発メモ
のバックアップ(No.9)
 

[トップ|一覧|単語検索|最終更新|バックアップ|ヘルプ]


String text = "Hello World!"; Pattern p = Pattern.compile("Hello"); Matcher m = p.matcher(text); if (m.find()) { } else { } String text = "www.hoge.net"; Pattern p = Pattern.compile("\\.net"); String replaced = m.replaceFirst(".info"); System.out.println(replaced); Matcher m = p.matcher(st); String replaced = m.replaceAll(""); String text = "Name: Regular Expressions"; Pattern p = Pattern.compile("^(\\w+):\\s+(.+)$"); String key = m.group(1); // key = "Name"; String value = m.group(2); // value = "Regular Expressions"; System.out.println("key = " + key); System.out.println("value = " + value); String text = "<a href=\"http://www.hoge.net/\">HOGE</a>"; String replaced = text.replaceFirst("<a href=\"(.+?)\">(.+?)</a>", Pattern p = Pattern.compile("(\\p{InBasicLatin}+|" + " \\p{InHiragana}+|" + " \\p{InKatakana}+|" + " \\p{InCJKUnifiedIdeographs}+)", Pattern.COMMENTS); while (m.find()) { String chunk = m.group(1); System.out.println(chunk); String replaced = text.replaceAll("<.+?>", "");
トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS

Modified by MT22(Moriwaki Takashi)

"PukiWiki" 1.3.7 Copyright © 2001,2002,2003 PukiWiki Developers Team. License is GNU/GPL.
Based on "PukiWiki" 1.3 by sng
Powered by PHP 7.4.28

HTML convert time to 0.029 sec.