using System; using System.Text.RegularExpressions; namespace WebApplication5 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { lb.Text = "ares@xizhang.com 555 ares@microsoft.com"; } } protected void submit_Click(object sender, EventArgs e) { string temp = lb.Text; lb.Text = Regex.Replace(temp, @"[\w\.=-]+@[\w\.-]+\.[\w]{2,3}", c => { return string.Format("{0}", c); }); } } }
使用正则表达式实现搜索关键字高亮显示
最新推荐文章于 2024-05-01 22:13:13 发布