I am trying to split pipe delimited text using the Util.split() method. However, instead of splitting the string based upon the pattern, it is splitting the string along every character. I included a code example below. When I split the pipe delimited string, I get 39 results. When I split the comma delimited string, I get 7 results, which is what I want. Does anyone have any suggestions?
Thank You, Cassandra import org.apache.oro.text.regex.*; import java.util.ArrayList; public class TestSplit { private static String pipes = "E|1|1|abdomen|abdomen|abdomin|abdomin"; private static String commas = "E,1,1,abdomen,abdomen,abdomin,abdomin"; public TestSplit() {} public static void main( String[] args )throws Exception { ArrayList results = new ArrayList(); Pattern commaPattern = null; Pattern pipePattern = null; PatternMatcher matcher = new Perl5Matcher(); PatternCompiler compiler = new Perl5Compiler(); pipePattern = compiler.compile("|"); commaPattern = compiler.compile(","); Util.split(results, matcher, commaPattern, commas, Util.SPLIT_ALL); System.out.println("Number with commas: " + results.size()); results.clear(); Util.split(results, matcher, pipePattern, pipes, Util.SPLIT_ALL); System.out.println("Number with pipes: " + results.size()); } } ------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. ============================================================================== -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>