Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Splitting a String by punctuation and whitespace using regex

807591May 16 2008 — edited May 17 2008
Hello

I was wondering if anyone knew a way to split a string by punctuation and whitespace, for example let's say I have a string that says,

Man, he was fast. I've never seen that before!

and I want to use the split() method to split the string into the following array

\ "Man" \ "," \ "he" \ "was" \ "fast" \ "." \ "I've" \ "never" \ "seen" \ "that" \ "before" \ "!" \
where each backslash division above is equivalent to a cell in the array

if anyone could offer any suggestions or a place to look online that would be appreciated. I've tried looking online and in the API docs. I also tried several regex expressions to with no luck.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 14 2008
Added on May 16 2008
11 comments
1,900 views