I have this string which id like to delimit using Java Pattern. There is also a carriage return character after the first line. The delimiter character is |
MSH|^~\&|Unicare^HL7CISINV10.00.16^L||IBA||||ADT^A03|3203343722|P|2.3.1|||||
EVN|A03
I used the following code.
Pattern pattern = Pattern.compile("([^|]++)*");
Matcher matcher = pattern.matcher(str);
while (matcher.find()) {
System.out.println("Result: \"" + matcher.group() + "\"");
}
Doing this basically shows empty characters for each of the delimiter character. I would like find to ignore these. Any chance of modifying the regex so the characters can be ignored.
Thanks in advance.
([^|]++)*to[^|]++?