从http://msdn.microsoft.com/zh-cn/library/windows/desktop/aa365247(v=vs.85).aspx中,我们知道Windows保留了一些字符:
< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
我有一个包含文件名来的那些特殊字符,我想,以取代那些有“”,这样的事情(与string.replace(/ \ <> /克,“”)
谢谢
您可以将所有这些字符放在一个字符集中:
string.replace( /[<>:"\/\\|?*]+/g, '' );
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句