fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string post = "<font color=\"#000fff\" size=\"1\" face=\"Arial\">Genuine Windows® 7 Home Premium (64-bit)</font>";
  9. post = Regex.Replace(post, "<font color=\"([a-fA-F0-9\\#]+)\"[^>]*>(.*?)</font>",
  10. m => "[color=\"" + m.Groups[1].Value + "\"]" + m.Groups[2].Value + "[/color]");
  11. Console.WriteLine(post);
  12. }
  13. }
Success #stdin #stdout 0.08s 38272KB
stdin
Standard input is empty
stdout
[color="#000fff"]Genuine Windows? 7 Home Premium (64-bit)[/color]