string p = @"(\d+)℃~(\d+)℃";
string s = "29℃~20℃";
string result = Regex.Match(s, p).Groups[0].Value;
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
String s = "29℃~20℃";
Regex reg = new Regex("[0-9]+");
MatchCollection m = reg.Matches(s);
Console.WriteLine(m[0].Value);
Console.WriteLine(m[1].Value);
Console.ReadLine();
}
}
}```
输出(第一个就是你要的)
29
20
星期二
。。是这里里面的29