• Post Reply Bookmark Topic Watch Topic
  • New Topic

write a java code to search for a pattern VX#*#VX IN A TEXT FILE  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
write a java code to search for a pattern VX#*#VX IN A TEXT FILE
 
joieyta sen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a quick help, please help someone
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Unfortunately, we are NotACodeMill (<=link)
What have you tried so far and where are you stuck.
In case you are confused on where to start check out http://docs.oracle.com/javase/tutorial/essential/regex/ and http://www.vogella.com/tutorials/JavaRegularExpressions/article.html
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
joieyta sen wrote:I need a quick help, please help someone

You really need to EaseUp because PatienceIsAVirtue
 
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:
In case you are confused on where to start check out http://docs.oracle.com/javase/tutorial/essential/regex/ and http://www.vogella.com/tutorials/JavaRegularExpressions/article.html


While I am a great fan of regular expressions, if the OP has a large number of files to process they may not be the best solution for this problem. There are several very efficient algorithms for searching for a fixed text sequence and, since it does not require backtracking, the one I use for searching a file is Knuth-Morris-Pratt
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per the OP it is 'A TEXT FILE'. Agree regex might or might not be the optimal solution. I personally have always been uncomfortable and struggled with regex
Thanks for the Knuth-Morris-Pratt link. I was not aware of it. I am sure it will make interesting reading
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:As per the OP it is 'A TEXT FILE'.


Of course if it is just a single text file the OP has to process then why bother to write a program to do this; the OP should just use his favourite text editor.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!