正则怎么获得21456688754

zhanghui1234w 2013-01-06 12:07:07
http://item.taobao.com/item.htm?id=21456688754&ali_refid=a3_420763_1007:1102249745:7:4043f4c103d9bc6af0a150eaaa84293d:809ab74692c8b2532811f1c84fbbe72b&ali_trackid=1_809ab74692c8b2532811f1c84fbbe72b
...全文
180 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ask8cn 2013-01-07
  • 打赏
  • 举报
回复
@"(?<=id=)\d+"
mr_cheung 2013-01-07
  • 打赏
  • 举报
回复
引用 3 楼 dalmeeme 的回复:
C# code?123string s = "http://item.taobao.com/item.htm?id=21456688754&ali_refid=a3_420763_1007:1102249745:7:4043f4c103d9bc6af0a150eaaa84293d:809ab74692c8b2532811f1c84fbbe72b&ali_t……
引用 2 楼 ohkuy 的回复:
C# code?1234567891011public static void Main() { string str = @"http://item.taobao.com/item.htm?id=21456688754&ali_refid=a3_420763_1007:1102249745:7:4043f4c103d9bc6a……
1
dalmeeme 2013-01-06
  • 打赏
  • 举报
回复
		string s = "http://item.taobao.com/item.htm?id=21456688754&ali_refid=a3_420763_1007:1102249745:7:4043f4c103d9bc6af0a150eaaa84293d:809ab74692c8b2532811f1c84fbbe72b&ali_trackid=1_809ab74692c8b2532811f1c84fbbe72b";
		string id = HttpUtility.ParseQueryString(new Uri(s).Query)["id"];
		Response.Write(id);
ohkuy 2013-01-06
  • 打赏
  • 举报
回复

public static void Main()
        {
            string str = @"http://item.taobao.com/item.htm?id=21456688754&ali_refid=a3_420763_1007:1102249745:7:4043f4c103d9bc6af0a150eaaa84293d:809ab74692c8b2532811f1c84fbbe72b&ali_trackid=1_809ab74692c8b2532811f1c84fbbe72b";
            Regex reg = new Regex(@"(?<=id=)(\d+)");
            if (reg.IsMatch(str))
            {
                Match m = reg.Match(str);
                Console.WriteLine(m.Value);
            }
            Console.Read();
        }
输出: 21456688754
  • 打赏
  • 举报
回复
(?i)(?<=[^a-z]id=)\d+

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧