Skip to content

Instantly share code, notes, and snippets.

@uprime22
Last active May 5, 2024 17:16
Show Gist options
  • Save uprime22/64db67c1f7ac756fc1de860f6f2fae26 to your computer and use it in GitHub Desktop.
Save uprime22/64db67c1f7ac756fc1de860f6f2fae26 to your computer and use it in GitHub Desktop.
適当な文字列から、半角英数日本語ピリオド以外を除きファイル名に使えそうな文字列を再構築する正規表現
function makeFilename(s){
var filename =
s.replace(/[^\.A-Za-z0-9\u30e0-\u9fcf\u3040-\u309f\u30a0-\u30ff]/gi, '');
return (filename);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment