File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes pattern class issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "pattern class issue" Watch "pattern class issue" New topic

pattern class issue

arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
Hi I have a data file which I am reading according to following pattern

Pattern p = Pattern.compile("[\\p{Punct}&&[|]]");

Now it is reading all lines but it is not able to find out end of file so ging exception required string is empty

any idea
H480988672|AAA|AAA|2006-09-23 06:23:57|B|AAA|AAA|1|0|0|0|0|0|10|0|0|mcannone|2006-09-23|
H573193578|KAA|KAA|2006-09-23 06:23:58|B|KAA|KAA|21|0|2|0|0|0|0|0|0|pgarcia|2006-09-23|
H583114428|KAA|KAA|2006-09-23 06:23:59|B|KAA|KAA|2221|0|2|0|0|0|0|0|0|pgarcia|2006-09-23|
H480985619|AAA|AAA|2006-09-23 06:23:56|B|AAA|AAA|3|0|3|0|0|0|9|0|0|mcannone|2006-09-23
Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
This probably belongs in beginner or intermediate - but if you are having trouble detecting the end of a file - why don't you post the file reading code?
arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
String [] lineItems = p.split(line); to be replaced by
String [] lineItems = p.split(line.trim());
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
I don't understand your question, but I can tell you that this regex: means the same thing as this:
arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
Hi alna issue solved.I need to chaneged to line.trim()
subject: pattern class issue
Similar Threads
file read
Query problem with MySQL 5
read issue
JSF Example Error