match and replace the "Updated" comment
match and replace the "Updated" comment

file:a/Rakefile -> file:b/Rakefile
--- a/Rakefile
+++ b/Rakefile
@@ -4,9 +4,9 @@
   desc "update the date in the appcache file (in the gh-pages branch)"
   task :update do
     appcache = File.read("cache.appcache")
-    updated  = "# Updated: #{DateTime.now}\n"
+    updated  = "# Updated: #{DateTime.now}"
 
-    File.write("cache.appcache", appcache.sub(/\A(#.*$\n)?/, updated))
+    File.write("cache.appcache", appcache.sub(/^# Updated:.*$/, updated))
   end
 end
 

comments