Hi, everybody.
Guys, I need help.
I want to restrict registering of Cyrillics characters in nicknames (JIDs) and deny Cyrillic JIDs at all.
How can I do this?
To access the most up-to-date ejabberd documentation, please visit docs.ejabberd.im »
Hi, everybody.
Guys, I need help.
I want to restrict registering of Cyrillics characters in nicknames (JIDs) and deny Cyrillic JIDs at all.
How can I do this?
In those regexps on the page
In those regexps on the page that you cite, you somehow forget that names usually consist of more than one character.
I would suggest something like "^[\x20-\x7F]+$" or "^[0-9A-Za-z\-]+$" (note the plus :) )
mikekaganski, thanks for
mikekaganski, thanks for answer!
Smth like this?
In ejabberd.cfg:
Am I right?
Note that erlang treats "\"
Note that erlang treats "\" as its own escaping character. So if you need to include the "\" into the regex pattern (say, if you need "-" inside square brackets), then you need to double-escape this in ejabberd.cfg:
{access, register}
{acl, somechars, {user_regexp, "^[0-9A-Za-z.\\-]+$"}}.
{access, register, [{allow, somechars}, {deny, all}]}.
(I put the dot here unescaped, as it is not a metacharacter inside square brackets, but no harm if you will escape it, too)
Also note that ejabberd.cfg is utf-8-encoded, and must not include the BOM. This is important if you use internationalized characters in it (like in your initial pattern "[а-яА-Я]"). If your editor includes BOM, or if it saves your file as ACSII, then ejabberd may not work properly. I use Cyrillic characters in my ejabberd.cfg (my users, to the contrary, almost exclusively use Cyrillic characters in their uids), and it works. Still, I don't know if this works with regex, because in utf-8, internationalized characters are multibyte, and this will work only if the string is internally converted to utf-16 and then passed to regex module, or if the regex module knows how to treat multibyte utf-8 sequences. This needs trial. Possibly you may need to use "\x{ABC}" to succeed in this case.
Mike, thanks for help!
Mike, thanks for help!