Regular expression to extract the year from a string

后端 未结 5 825
盖世英雄少女心
盖世英雄少女心 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:23

    You need to escape the parentheses. Also you can restrict that a year has only got 4 numbers:

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

    The year is in matchgroup 2.

提交回复
热议问题