<!---$S1PICTURE--->
<!---$S2PICTURE--->
<!---$S3PICTURE--->
....
<!---$SnPICTURE--->求匹配上面的正则表达式

解决方案 »

  1.   

    using System.Text.RegularExpressions;// Regex Match code for C#
    void MatchRegex()
    {
        // Regex match
        RegexOptions   options = RegexOptions.IgnoreCase | RegexOptions.Singleline;
        Regex          regex = new Regex(@"<!\-\-\-\$S\d+PICTURE\-\-\->", options);
        string         input = @"<!---$S3PICTURE--->";    // Check for match
        bool   isMatch = regex.IsMatch(input);
        if( isMatch )
        {
            // TODO: Do something with result
            System.Windows.Forms.MessageBox.Show(input, "IsMatch");
        }}