Regular Expression to collect everything after the last /

前端 未结 8 1882
北荒
北荒 2020-11-28 05:16

I\'m new at regular expressions and wonder how to phrase one that collects everything after the last /.

I\'m extracting an ID used by Google\'s GData.

8条回答
  •  误落风尘
    2020-11-28 05:38

    /^.*\/(.*)$/
    

    ^ = start of the row

    .*\/ = greedy match to last occurance to / from start of the row

    (.*) = group of everything that comes after the last occurance of /

提交回复
热议问题