正则表达式 循环 满足条件

来源:互联网 发布:2016网络唱歌比赛 编辑:程序博客网 时间:2024/06/11 18:34

GetControlValue 为函数

 

 

public static string ReplaceControlName(AsapExlib.Base.BaseForm bf,string Txt)
        {
            foreach (Match m in Regex.Matches(Txt, @"/{(.+?)/}"))
            {
                Txt = Txt.Replace(m.Groups[0].Value, GetControlValue(bf, m.Value));
            }

            return Txt;
//System.Text.RegularExpressions.Regex.Replace(Txt, @"/{(.+?)/}", GetControlValue(bf,"$1"), System.Text.RegularExpressions.RegexOptions.IgnoreCase);
        }

原创粉丝点击