Regex and unicode

前端 未结 4 535
死守一世寂寞
死守一世寂寞 2020-12-03 04:51

I have a script that parses the filenames of TV episodes (show.name.s01e02.avi for example), grabs the episode name (from the www.thetvdb.com API) and automatically renames

4条回答
  •  醉话见心
    2020-12-03 05:42

    Use a subrange of [\u0000-\uFFFF] for what you want.

    You can also use the re.UNICODE compile flag. The docs say that if UNICODE is set, \w will match the characters [0-9_] plus whatever is classified as alphanumeric in the Unicode character properties database.

    See also http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-05/2560.html.

提交回复
热议问题