• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.util.regex Class Matcher/Pattern

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to use Matcher and Pattern functionality to extract data between a pair of

"

(an opening

"

and a closing

"

).
How can I do that ?

The end game is really the following ... I have a comma separated file (cvs) which contains lines like

1, "Hello word1", "1", "today, tomorrow"



Wich obviously does not loaded properly since I have commas WITHIN a string

"today, tomorrow"



Anyone done that yet ? anything would do Perl,Excel macro, java, ...

Thx

Pascal
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless this is an exercise in learning regular expressions, why not use an existing library for reading CSV? There are a number of edge cases you need to consider to do it properly, and before you've coded those, you've likely mastered that CSV class.
 
Pascal Got
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could do,

I originally intended to have a perl script for that but can't figure out how to make it work, so am also trying Java.

Where can I find the csv libraries ?
is it a Sun/JDK thing ?

Thx
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It hides behind the link in my post.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic