How to keep the delimiter while using RegEx?
问题 I did a question about punctuation and regex, but it was confusing. Supossing I have this text: String text = "wor.d1, :word2. wo,rd3? word4!"; I'm doing this: String parts[] = text.split(" "); And I have this: wor.d1, | :word2. | wor,d3? | word4!; What I need to do to have this? (Keep the the symbols at the borders, but only that I specify: .,!?: , not all). wor,d1 | , | : | word2 | . | wor,d3 | ? | word4 | ! UPDATE I'm getting some good results with these regex, but it's giving an empty