This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "pattern class issue" Watch "pattern class issue" New topic
Author

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()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: pattern class issue
 
Similar Threads
JSF Example Error
java.rmi.ConnectException
Query problem with MySQL 5
file read
read issue