Results 1 to 1 of 1
Thread: Need help to parse text files.
- 11-11-2011, 03:11 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 1
- Rep Power
- 0
Need help to parse text files.
I am learning Java and need some assistance.
I'm trying to make a program that can scrape some data out of a text file and get certain important parts. The text files contains the source code for an ebay auction. What I am trying to do is grab key parts like the price, item location, etc.
I can get the source code and save it to a file and I can read and write files. What I need to figure out is how to grab that particular part of the file.
I know that I can use regular expressions to match things that I'm looking for, but how can I grab a part of the file that is after the match to the regex? I was able to match a line in the file that has the particular piece of info I want and store that in a separate string, but the line is quite long and I'm not sure how to break it down to get at what I need, or handle a situation where the rest of the information is on the next line.
Ideally I would like to get whatever is left on the line after the regex match, and then do a string tokenizer with a space delimiter which should capture the data and I can have it end when it reaches something like a < or "
I suppose I could take a whole line and tokenize it but there has to be a better way. Any assistance is appreciated.
Similar Threads
-
Parse .java files
By axenos in forum Advanced JavaReplies: 9Last Post: 04-22-2011, 04:42 AM -
how to parse an input files that have different types of delimiters
By renu in forum New To JavaReplies: 10Last Post: 04-12-2011, 06:00 PM -
Use Scanner to parse text file, adding to HashMap
By JordashTalon in forum New To JavaReplies: 0Last Post: 03-04-2009, 11:08 PM -
Behaving text files like binary files
By Farzaneh in forum New To JavaReplies: 2Last Post: 08-27-2008, 03:20 PM -
Text and image files within jar files
By erhart in forum Advanced JavaReplies: 8Last Post: 01-19-2008, 04:43 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks