当前位置: 代码迷 >> JavaScript >> 正则如何获得21456688754
  详细解决方案

正则如何获得21456688754

热度:125   发布时间:2013-01-23 10:44:49.0
正则怎么获得21456688754
http://item.taobao.com/item.htm?id=21456688754&ali_refid=a3_420763_1007:1102249745:7:4043f4c103d9bc6af0a150eaaa84293d:809ab74692c8b2532811f1c84fbbe72b&ali_trackid=1_809ab74692c8b2532811f1c84fbbe72b
正则

------解决方案--------------------
var str="http://item.taobao.com/item.htm?id=21456688754&ali_refid=a3_420763_1007:1102249745:7:4043f4c103d9bc6af0a150eaaa84293d:809ab74692c8b2532811f1c84fbbe72b&ali_trackid=1_809ab74692c8b2532811f1c84fbbe72b";
alert(str.match(/id\=(\d+)&/)[1]);
------解决方案--------------------
var str="http://item.taobao.com/item.htm?id=21456688754&ali_refid=a3_420763_1007:1102249745:7:4043f4c103d9bc6af0a150eaaa84293d:809ab74692c8b2532811f1c84fbbe72b&ali_trackid=1_809ab74692c8b2532811f1c84fbbe72b";
alert(str.match(/[^a-zA-Z]id=(\d+)/)[1])
  相关解决方案