Looking for a regex/replace function to take a user inputted string say, \"John Smith\'s Cool Page\" and return a filename/url safe string like \"john_smith_s_cool_page.html\",
I think your requirement is to replaces white spaces and aphostophy `s with _ and append the .html at the end try to find such regex.
refer
http://www.regular-expressions.info/javascriptexample.html