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
Python's re module doesn't support \p{Letter} or \X. However, the new regex implementation on PyPI does.
\X seems to be available as a generic word-character in some languages, it allows you to match a single character disregarding of how many bytes it takes up. Might be useful.
In Mastering Regular Expressions from Jeffrey Friedl (great book) it is mentioned that you could use \p{Letter} which will match unicode stuff that is considered a letter.
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.