【问题标题】:Regex, filter url ending with and without digit正则表达式,过滤网址以和不以数字结尾
【发布时间】:2016-09-25 07:47:31
【问题描述】:

我有以下四个 URL,我只想使用正则表达式过滤其中两个。

/chassis/motherboard/cpu

/chassis/motherboard/cpu/core0

/chassis/motherboard/cpu0

/chassis/motherboard/cpu1/core0

我尝试过使用^.*[0-9a-z_].cpu,但无法找到解决方案。

【问题讨论】:

    标签: python regex url filter uri


    【解决方案1】:

    你可以使用这个正则表达式:

    ^.*/cpu[0-9]*$
    

    这将匹配以/cpu/cpy<number> 结尾的任何文本

    【讨论】:

      猜你喜欢
      • 2016-01-17
      • 1970-01-01
      • 2013-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-08
      相关资源
      最近更新 更多