#irccolor http://stackoverflow.com/questions/146134/how-to-remove-illegal-characters-from-path-and-filenames {{{#!gcode string invalidPathChars = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars()); foreach (char c in invalidPathChars) { illegal = illegal.Replace(c.ToString(), ""); } }}} {{{#!gcode string regexSearch = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars()); Regex r = new Regex(string.Format("[{0}]", Regex.Escape(regexSearch))); illegal = r.Replace(illegal, ""); }}} ==== cf. ==== 윈도우의 경우. {{{#!gcode foreach (char c in invalidPathChars) { Debug.Write(c.ToString() + "; " + Convert.ToByte(c).ToString("X2")); } }}} {{{ CHAR HEX "; 22 <; 3C >; 3E |; 7C [; 01 ]; 02 ; 03 ; 04 ; 05 ; 06 ; 07 ; 08 ; 09 ; 0A ; 0B ; 0C ; 0D ; 0E ; 0F ; 10 ; 11 ; 12 ; 13 ; 14 ; 15 ; 16 ; 17 ; 18 ; 19 ; 1A ; 1B ; 1C ; 1D ; 1E ; 1F :; 3A *; 2A ?; 3F \; 5C /; 2F "; 22 <; 3C >; 3E |; 7C [; 01 ]; 02 ; 03 ; 04 ; 05 ; 06 ; 07 ; 08 ; 09 ; 0A ; 0B ; 0C ; 0D ; 0E ; 0F ; 10 ; 11 ; 12 ; 13 ; 14 ; 15 ; 16 ; 17 ; 18 ; 19 ; 1A ; 1B ; 1C ; 1D ; 1E ; 1F }}} 유닉스의 경우 [01:14] <04hyacinth> !csharp string os_info = System.Environment.OSVersion.VersionString; System.Console.Write(os_info); [01:14] <01냐옹이컨벤션센터> Unix 3.13.0.30 [01:08] <04hyacinth> !csharp string invalidPathChars = new string(System.IO.Path.GetInvalidFileNameChars()) + new string(System.IO.Path.GetInvalidPathChars()); [01:08] <01냐옹이컨벤션센터> (no output) [01:08] <04hyacinth> !csharp string invalidPathChars = new string(System.IO.Path.GetInvalidFileNameChars()) + new string(System.IO.Path.GetInvalidPathChars()); foreach (char c in invalidPathChars){System.Console.Write(c.ToString() + "; " + System.Convert.ToByte(c).ToString("X2"));}} [01:08] <01냐옹이컨벤션센터> (1,254): error CS1525: Unexpected symbol `}' [01:09] <04hyacinth> !csharp string invalidPathChars = new string(System.IO.Path.GetInvalidFileNameChars()) + new string(System.IO.Path.GetInvalidPathChars()); foreach (char c in invalidPathChars){System.Console.Write(c.ToString() + "; " + System.Convert.ToByte(c).ToString("X2"));} [01:09] <01그건아니지> ... [01:10] <04hyacinth> !csharp string invalidPathChars = new string(System.IO.Path.GetInvalidFileNameChars()) + new string(System.IO.Path.GetInvalidPathChars()); foreach (char c in invalidPathChars){System.Console.Write(c.ToString() + "; " + System.Convert.ToByte(c).ToString("X2"));}System.Console.Write(invalidPathChars.Length.ToString()); [01:10] <04hyacinth> !csharp string invalidPathChars = new string(System.IO.Path.GetInvalidFileNameChars()) + new string(System.IO.Path.GetInvalidPathChars()); System.Console.Write(invalidPathChars.Length.ToString()); [01:10] <01냐옹이컨벤션센터> 3 [01:11] <04hyacinth> !csharp string invalidPathChars = new string(System.IO.Path.GetInvalidFileNameChars()) + new string(System.IO.Path.GetInvalidPathChars()); System.Console.Write(System.Convert.ToByte(invalidPathChars[0]).ToString("X2")); [01:11] <01냐옹이컨벤션센터> 00 [01:11] <04hyacinth> !csharp string invalidPathChars = new string(System.IO.Path.GetInvalidFileNameChars()) + new string(System.IO.Path.GetInvalidPathChars()); System.Console.Write(System.Convert.ToByte(invalidPathChars[1]).ToString("X2")); [01:11] <01냐옹이컨벤션센터> 2F [01:11] <04hyacinth> !csharp string invalidPathChars = new string(System.IO.Path.GetInvalidFileNameChars()) + new string(System.IO.Path.GetInvalidPathChars()); System.Console.Write(System.Convert.ToByte(invalidPathChars[2]).ToString("X2")); [01:12] <01냐옹이컨벤션센터> 00