using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"[a-zA-Z0-9\x{4e00}-\x{9fa5}]+";
string input = @"What Does the Fox Say? 12 狐狸怎叫 34
What Does the shiba inu say? 柴犬怎叫
蘋果公司,原稱蘋果電腦公司,是總部位於美國加州庫比蒂諾的跨國科技公司,與亞馬遜,Google、微軟和Meta一起被認為是五大技術公司之一,合稱為MAMAA。
現時的業務包括設計、開發、手機通信和銷售消費電子、電腦軟體、線上服務和個人電腦。";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx