[Solved] Need the words between the ” – ” ONLY string splitting [duplicate]
So basically you to first split by – and then each side by a non-word character. Therefore you can try: String s = “ABC_DEF-HIJ (KL MNOP_QRS)”; String[] splits = s.split(“-“); // {“ABC_DEF”, “HIJ (KL MNOP_QRS)”} String[] lefts = split[0].split(“[^a-zA-Z]”); // {“ABC”, “DEF”} String[] rights = split[1].split(“[^a-zA-Z]”); // {“HIJ”, “”, “KL”, “MNOP”, “QRS”} String string1 = … Read more