config.set("pattern", "\\s+");
config.set("lowercase", "false");
CustomPatternAnalyzer a = new CustomPatternAnalyzer(config);
TokenStream tokenStream = a.tokenStream("test", "this is a Text with Whitespaces");
CharTermAttribute charTermAttribute = tokenStream.addAttribute(CharTermAttribute.class);
tokenStream.incrementToken();
String t2 = charTermAttribute.toString();
tokenStream.incrementToken();
String t3 = charTermAttribute.toString();