Regular expression to extract the year from a string

后端 未结 5 824
盖世英雄少女心
盖世英雄少女心 2020-12-19 22:54

This should be simple but i cant seem to get it going. The purpose of it is to extract v3 tags from mp3 file names in Mp3tag.

I have these strings I want to extract

5条回答
  •  独厮守ぢ
    2020-12-19 23:16

    I'd go with

    ^(.*)\s\(([0-9]{4})\)$
    

    (assuming all years have 4 digits, use [0-9]+ if you have an unknown number of digits, but at least one, or [0-9]* if there could be no digits)

提交回复
热议问题