kfdt74
V2EX  ›  问与答

如何用正则表达式分别匹配各大电商的 url

  •  
  •   kfdt74 · Sep 13, 2014 · 4959 views
    This topic created in 4449 days ago, the information mentioned may be changed or developed.
    6 replies  •  2014-09-13 10:37:58 +08:00
    Execution
    Execution
    Sep 13, 2014
    1
    同求
    Abirdcfly
    Abirdcfly
    Sep 13, 2014
    2
    我说的很可能是错的。但是
    第一个的链接可以是http://item.taobao.com/item.htm?id=17237347492 只要这个就好了。
    tianrunlin
    tianrunlin
    Sep 13, 2014❤️1
    3
    @Abirdcfly 你说的没错
    spm是淘宝的导购跟踪标记,utm是google分析的标记,直接去掉就好了
    http://item.taobao.com/item.htm?id=17237347492
    http://detail.tmall.com/item.htm?id=35259286943
    http://item.jd.com/941442.html
    kfdt74
    kfdt74
    OP
    Sep 13, 2014
    4
    我的需求是不管后面接什么参数都能通过正则找到并替换掉
    Doubear
    Doubear
    Sep 13, 2014
    6
    (\.com\/(\d+)|item\.html.*id=(\d+))
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2453 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 04:53 · PVG 12:53 · LAX 20:53 · JFK 23:53
    ♥ Do have faith in what you're doing.