I have string like \LESSING\root\cimv2:Win32_UserAccount.Domain="LESSING",Name="Admin" How to convert it to LESSING\Admin using Framework?
+4
A:
If your are sure of the syntax, maybe a regex... although regex is often overused, it seems to fit this time:
string input = @"\LESSING\root\cimv2:Win32_UserAccount.Domain=""LESSING"",Name=""Admin""";
string output = Regex.Replace(input, @"^.*Domain=""([^""]*)"",Name=""([^""]*)"".*$", @"$1\$2");
Marc Gravell
2009-06-21 13:00:51
It really works!!! THANK YOU!!!
Juri Bogdanov
2009-06-21 14:45:12