import java.util.*;import java.lang.*; class Main{ public static void main (String[] args) throws java.lang.Exception { String SPECIAL_CHARACTERS_REGEX = "[ ?:;'=\\()!\\[\\]-]+|(?<=\\d)(?=\\D)"; String rawMessage ="let's meet tomorrow at 9:30p? 7-8pm? i=you go (no Go!) [to do !]"; String[] tokens = rawMessage.split(SPECIAL_CHARACTERS_REGEX); System.out.println(Arrays.toString(tokens)); }}
Standard input is empty
[let, s, meet, tomorrow, at, 9, 30, p, 7, 8, pm, i, you, go, no, Go, to, do]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!