Possible Duplicate:
Parsing CSV input with a RegEx in java
I have an input file in which each line has input values of string of the following form:
" ab cd " , " efgh,ijk.", 4,"lmno"
i.e.,
- The words are either in quotes or they have no quotes.
- The space before and after the start and end word respectively is not allowed.
EDIT: 3. It can have inputs just separated by commas.(abc,"Hi Mary,Joe",5
)
Using .Split() in java, I need a regular expression to output this:
ab cd
efgh,ijk.
4
lmno
I tried this:
[^",]*[\",]
But this doesn't work on "efgh,ijk."
Here is a link for regex testing: http://regexpal.com/ I need some assistance on this. Please help. Thank you