<LookFor>~/.shtml</LookFor>
<SendTo>~/.aspx?id=$1</SendTo>.aspx?id=DZ107-20110609-46902582变成 dd/DZ107-20110609-46902582.shtml  
LookFor  节点内的正则咋写?

解决方案 »

  1.   

    <LookFor>~/dd/(\w+)-(\d+)-(\d+).shtml</LookFor>
      

  2.   

    哦 错了 你这是一个参数 
    dd/(\w+-\d+-\d+).shtml? 这样 ?
      

  3.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Globalization;
    using System.IO;
    using System.Text.RegularExpressions;namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
                string str2 = ".aspx?id=DZ107-20110609-46902582";
                string str3="<LookFor>~/.shtml</LookFor>";
                Regex reg2 = new Regex(@"(?i)(?<=.aspx\?).*");
                Regex reg3 = new Regex(@"~/");
                str2 = "dd/" + reg2.Matches(str2)[0].Value;
                Console.WriteLine(reg3.Replace(str3,str2));
                //<LookFor>dd/DZ107-20110609-46902582.shtml</LookFor>
            }
        }
    }
    坐等高人出现。