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\",
For more flexible and robust handling of unicode characters etc, you could use the slugify in conjunction with some regex to remove unsafe URL characters
const urlSafeFilename = slugify(filename, { remove: /"<>#%\{\}\|\\\^~\[\]`;\?:@=&/g });
This produces nice kebab-case filenemas in your url and allows for more characters outside the a-z0-9
range.