fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. string modify = "KLAX 032109Z 26014KT 10SM FEW070 SCT120 BKN220 21/17 A2986 RMK AO2";
  9.  
  10. modify = Regex.Replace(modify, "FEW([0-9]{3})", "few clouds at $1");
  11.  
  12. Console.WriteLine(modify);
  13.  
  14. modify = Regex.Replace(modify, @"(?s)(?<=[0-9]{2}SM)(.+?)0([0-9]{1})0.+?(?=[0-9]{2}/[0-9]{2})", "$1$2 thousand.");
  15.  
  16. Console.WriteLine(modify);
  17. }
  18. }
  19.  
Success #stdin #stdout 0.07s 34768KB
stdin
Standard input is empty
stdout
KLAX 032109Z 26014KT 10SM few clouds at 070 SCT120 BKN220 21/17 A2986 RMK AO2
KLAX 032109Z 26014KT 10SM few clouds at 7 thousand.21/17 A2986 RMK AO2