In function function restricted_text_prepare

$text = preg_replace_callback('/\[restrict(?::([\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]+)=?([^\]]+)?)?\](.+?)\[\/restrict\]/smu', "_restricted_text_replace_callback", $text);

1. \w is replaced by unicode equivalent [\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}] (see http://regexlib.com/CheatSheet.aspx)

This enables unicode string in place for 'roles' string.

2. Also the requirement for "=role1, role2" is now optional. Using "=?([^\]]+)?" instead of "=([^\]]+)"

3. Added /u. Apparently does nothing, but should have enabled unicode. Better safe than sorry.

Comments

udvranto’s picture

To include accents inlcude \p{M}. See http://www.regular-expressions.info/unicode.html

$text = preg_replace_callback('/\[restrict(?::([\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}\p{M}]+)=?([^\]]+)?)?\](.+?)\[\/restrict\]/smu', "_restricted_text_replace_callback", $text);
pukku’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)