\b - , [^A-Za-z]. \b if/then (. tchrist ), , , , . , , .
, , , [^a-zA-Z]+. , .
, :
import java.lang.String;
class RegexDemo {
private static void testSplit(String msg, String re) {
String[] pieces = "the quick brown fox".split(re);
System.out.println(msg);
for (String s : pieces) {
System.out.println(s);
}
System.out.println("----");
}
public static void main(String args[]) {
testSplit("boundary:", "\\b+");
testSplit("not alpha:", "[^A-Za-z]+");
}
}
, , String.split(), .
, ,
Pattern boundary = Pattern.compile("\\b+");
boundary.split(testString), . , , "\ b +" , , , , .
Russ Cox http://swtch.com/~rsc/regexp/ http://www.regular-expressions.info/.