111,126
社区成员
发帖
与我相关
我的任务
分享
string pattern = @"[\d.]+";
bool ismatch = Regex.IsMatch(richTextBox1.Text.Trim(), pattern);
if (ismatch)
{
MatchCollection mc = Regex.Matches(richTextBox1.Text.Trim(), pattern);
foreach (Match smc in mc)
{
richTextBox1.Select(richTextBox1.Text.Trim().IndexOf(smc.Value), smc.Value.Length);
richTextBox1.SelectionBackColor = Color.Blue;
richTextBox1.SelectionFont = new Font(@"宋体", 20);
}
}