String input = "Here is a WikiWord followed by AnotherWikiWord, then SomeWikiWord.";
Pattern pattern = Pattern.compile("[A-Z][a-z]*([A-Z][a-z]*)+");
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
System.out.println("Found this wiki word: " + matcher.group());
}
* This source code was highlighted with Source Code Highlighter.
На выходе должны быть:
Found this wiki word: WikiWordhttp://www.ibm.com/developerworks/ru/edu/j-intermed/section5.html
Found this wiki word: AnotherWikiWord
Found this wiki word: SomeWikiWord
Комментариев нет:
Отправить комментарий