From (v=vs.85).aspx, We know Windows reserve some characters:
< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
I have a file name which contains e of those special characters,
I want to replace those with "",
something like this (string.replace(/\<>/g, '')
Thanks
From http://msdn.microsoft./en-us/library/windows/desktop/aa365247(v=vs.85).aspx, We know Windows reserve some characters:
< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
I have a file name which contains e of those special characters,
I want to replace those with "",
something like this (string.replace(/\<>/g, '')
Thanks
- This is a challenging request as Windows has odd file name rules. See this SO article: stackoverflow./questions/754307/… – jwatts1980 Commented Aug 8, 2014 at 17:39
- thanks, I didn't find it when I google it. Sorry for ask dumplicate question – yongnan Commented Aug 8, 2014 at 17:44
1 Answer
Reset to default 8You can put all those characters inside a character set:
string.replace( /[<>:"\/\\|?*]+/g, '' );