tracks/java/exercises/word-count/.meta/src/reference/java/WordCount.java in trackler-2.2.1.91 vs tracks/java/exercises/word-count/.meta/src/reference/java/WordCount.java in trackler-2.2.1.92

- old
+ new

@@ -5,10 +5,10 @@ public class WordCount { public Map<String, Integer> phrase( String input ) { Map<String, Integer> countMap = new HashMap<>(); - input = input.trim().toLowerCase().replaceAll("[\\W]", " "); + input = input.trim().toLowerCase().replaceAll("([^A-Za-z0-9']|\\B'|'\\B)", " "); final String[] tokenizedInput = input.split("\\s+"); for( String aWord : tokenizedInput ) { Integer count = countMap.get(aWord); countMap.put(aWord, count == null ? 1 : count + 1 ); }