This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes pattern matcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "pattern matcher" Watch "pattern matcher" New topic
Author

pattern matcher

Shashank Sharma
Ranch Hand

Joined: Sep 27, 2006
Posts: 91

if I remove the comments then the the while lop does not print any thing..,,..
but the replaceAll method is not changing the original string but returning a new modified string.
please help..
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18509
    
  40


The replaceAll() method uses the find() method, and hence, already found everything. If you want to find again, then reset the matcher.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: pattern matcher
 
Similar Threads
Regular expression - Pattern and matcher
Regex Question - Greedy Quantifier ?
Regex: find() method
parse a string
Use regex for this?