I have the following php code in a utf-8 php file:
var_dump(setlocale(LC_CTYPE, \'de_DE.utf8\', \'German_Germany.utf-8\', \'de_DE\', \'german\'));
var_dump(m
Even in UTF-8 mode, standard class shorthands like \w and \b are not Unicode-aware. You just have to use the Unicode shorthands, as you worked out, but you can make it a little less ugly by using lookarounds instead of alternations:
/(?
Notice also how I left the curly braces out of the Unicode class shorthands; you can do that when the class name consists of a single letter.