Im trying to replace all mentions of .html in a html fine to .jsp. For example if i had:
Some Text Here
<a href ="page1.html"> Go to Page1
i would want to ONLY replace the .html in the link.
String replace= src.replaceAll(".html", ".jsp");
i succesfully replace the .html in the link but i also replace the html at the start and at the beginning despite them not having a "." in front of them? Any ideas on how to fix this PLEASE
Look at the Pattern class, search to match the pattern.
Did you try to use an escape code before the period? ("\.html")
it should be ("\\.html"), since \ has to be escaped within strings with \\. the dot is the regular expression for anycharacter.
Last Post: 10-03-2007, 07:47 AM
Last Post: 12-31-2005, 08:38 PM
By Dennis in forum Database
Last Post: 01-23-2003, 12:50 PM
By Jose Rodz in forum Java
Last Post: 11-15-2002, 03:41 PM
Last Post: 05-28-2002, 06:18 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL