wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regular expression required" Watch "Regular expression required" New topic
Author

Regular expression required

Leno Skosan
Greenhorn

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:

1234
'abc'
null
'def,ghi'
5678
'jkl',
'mno ,pqr, stuv'

Any suggestions?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

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
Bartender

Joined: Oct 02, 2003
Posts: 11168
    
  16

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: http://aspose.com/file-tools
 
subject: Regular expression required
 
Similar Threads
how to split "abc-def - ghi-jkl"?
Parsing a String value in StoredProcedure???
Problem in regular expression for matching
problem in writing Regular Expression
Regular expressions to handle sequence of special characters