/ Published in: Java
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//http://cc-cedict.org/wiki/start Pattern line_pattern = Pattern.compile("([^\\s]+)\\s([^\\s]+)\\s(\\[.+\\])\\s(/.+/)"); Matcher matcher = line_pattern.matcher(line); boolean matchFound = matcher.find(); while(matchFound) { for(int i = 0; i <= matcher.groupCount(); i++) { } if(matcher.end() + 1 <= line.length()) { matchFound = matcher.find(matcher.end()); } else{ break; } } Tå—帳 Tå—å¸ [T zi4 zhang4] /T-account (accounting)/ 0-47 0:Tå—帳 Tå—å¸ [T zi4 zhang4] /T-account (accounting)/ 1:Tå—帳 2:Tå—å¸ 3:[T zi4 zhang4] 4:/T-account (accounting)/