1
using System;
using System.IO;
class Test
{
public static void Main()
{
try
{
using (StreamReader sr = new StreamReader("TestFile.txt"))
{
String line = sr.ReadToEnd();
Console.WriteLine(line);
}
string pattern1 = @"(in cm)";
string pattern2 = @"mm";
Regex rgx1 = new Regex(pattern1);
Regex rgx2 = new Regex(pattern2);
Regex rgx3 = new Regex(pattern3);
}
catch (Exception e)
{
Console.WriteLine("The file could not be read:");
Console.WriteLine(e.Message);
}
}
}
如何使用正則表達式在C#以下釐米的文件轉換到M:正則表達式轉換輸入C#
rectangle (in cm) 20 H * 40 W and circle diameter 30 mm