Revision: 51869
Updated Code
at October 6, 2011 14:48 by hyderai
Updated Code
//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) {
System.out.println(matcher.start() + "-" + matcher.end());
for(int i = 0; i <= matcher.groupCount(); i++) {
String groupStr = matcher.group(i);
System.out.println(i + ":" + groupStr);
}
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)/
Revision: 51868
Updated Code
at October 6, 2011 14:46 by hyderai
Updated Code
//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) {
System.out.println(matcher.start() + "-" + matcher.end());
for(int i = 0; i <= matcher.groupCount(); i++) {
String groupStr = matcher.group(i);
System.out.println(i + ":" + groupStr);
}
if(matcher.end() + 1 <= line.length()) {
matchFound = matcher.find(matcher.end());
}
else{
break;
}
}
TÃ¥Â�帳 TÃ¥Â�� [T zi4 zhang4] /T-account (accounting)/
result:
0-47
0:TÃ¥Â�帳 TÃ¥Â�� [T zi4 zhang4] /T-account (accounting)/
1:TÃ¥Â�帳
2:T�
3:[T zi4 zhang4]
4:/T-account (accounting)/
Revision: 51867
Updated Code
at October 6, 2011 14:41 by hyderai
Updated Code
//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) {
System.out.println(matcher.start() + "-" + matcher.end());
for(int i = 0; i <= matcher.groupCount(); i++) {
String groupStr = matcher.group(i);
System.out.println(i + ":" + groupStr);
}
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)/
Revision: 51866
Updated Code
at October 6, 2011 14:39 by hyderai
Updated Code
//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) {
System.out.println(matcher.start() + "-" + matcher.end());
for(int i = 0; i <= matcher.groupCount(); i++) {
String groupStr = matcher.group(i);
System.out.println(i + ":" + groupStr);
}
if(matcher.end() + 1 <= line.length()) {
matchFound = matcher.find(matcher.end());
}
else{
break;
}
}
Revision: 51865
Updated Code
at October 6, 2011 14:31 by hyderai
Updated Code
//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) {
System.out.println(matcher.start() + "-" + matcher.end());
for(int i = 0; i <= matcher.groupCount(); i++) {
String groupStr = matcher.group(i);
System.out.println(i + ":" + groupStr);
}
if(matcher.end() + 1 <= line.length()) {
matchFound = matcher.find(matcher.end());
}
else{
break;
}
}
Revision: 51864
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 6, 2011 14:27 by hyderai
Initial Code
//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) {
System.out.println(matcher.start() + "-" + matcher.end());
for(int i = 0; i <= matcher.groupCount(); i++) {
String groupStr = matcher.group(i);
System.out.println(i + ":" + groupStr);
}
if(matcher.end() + 1 <= line.length()) {
matchFound = matcher.find(matcher.end());
}
else{
break;
}
}
/*
TÃ�Â¥Ã�ÂÂ��¥�¸�³ TÃ�Â¥Ã�ÂÂ��¥�¸ï¿½ [T zi4 zhang4] /T-account (accounting)/
Result:
0-47
0:TÃ�Â¥Ã�ÂÂ��¥�¸�³ TÃ�Â¥Ã�ÂÂ��¥�¸ï¿½ [T zi4 zhang4] /T-account (accounting)/
1:TÃ�Â¥Ã�ÂÂ��¥�¸�³
2:TÃ�Â¥Ã�ÂÂ��¥�¸ï¿½
3:[T zi4 zhang4]
4:/T-account (accounting)/
*/
Initial URL
Initial Description
Initial Title
regular expression for CEDICT
Initial Tags
Initial Language
Java