This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Java in General and the fly likes Regular expression required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regular expression required" Watch "Regular expression required" New topic

Regular expression required

Leno Skosan

Joined: Apr 23, 2010
Posts: 3
Hi guys,

I have the following comma separated values in a string "1234,'abc',null,'def,ghi',5678,'jkl','mno ,pqr, stuv'". What I want to do is to split the string as follows:

'mno ,pqr, stuv'

Any suggestions?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10747

What have you tried so far and where are you stuck?
I would suggest looking into the String class for a method which would help you split the given string (hint)
Agreeably, this would not be an optimal way of doing things, but its the easiest.

Edit: Ok. My bad. I did not read the title mention regular expression.
So, even then, my original question still stands. What have you tried so far and where are you stuck

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11876

I am not a regex guru. I have no idea how to do this with a regex...but I could probably do it with two.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree. Here's the link:
subject: Regular expression required
It's not a secret anymore!