This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
What were you expecting it to print out? \w means "any word character" (letter, digit, underscore). So what you're doing there is roughly the equivalent of splitting the string",, ,, , #" on commas. Can you see now why it would include empty strings?
Joined: Jan 19, 2013
I was expecting it to print "> <> <> #" without the empty string.From where this empty string comes from.
The empty string comes because you've got tokens you are splitting on (like 'x' and '1') that have no characters between them. Similarly, my example has consecutive commas - this will cause an empty string when you split on commas.