# Discourse 用户名规则是什么？

**URL:** https://meta.discourse.org/t/what-are-the-discourse-rules-for-usernames/160367
**Category:** Support
**Created:** [2020年八月10日 15:08 UTC](https://meta.discourse.org/t/what-are-the-discourse-rules-for-usernames/160367 "2020-08-10T15:08:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![abi\_at\_work](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abi_at_work/32/189626_2.png) [@abi\_at\_work](https://meta.discourse.org/u/abi_at_work)
#### Post date: [2020年八月10日 15:08 UTC](https://meta.discourse.org/t/what-are-the-discourse-rules-for-usernames/160367/1 "2020-08-10T15:08:22Z")

</div>

你好，请问有人能指点一下用户名的规则吗？我想确认一下是否允许使用&符号和撇号，但我在这里找不到任何相关信息。非常感谢。

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2020年八月10日 16:24 UTC](https://meta.discourse.org/t/what-are-the-discourse-rules-for-usernames/160367/2 "2020-08-10T16:24:43Z")

</div>

欢迎，@abi_at_work！

回答您问题的一个简单实证方法是访问 [try.discourse.com](http://try.discourse.com)，看看那里可以创建哪些用户名！

如果您想知道确切规则，可以查看代码：

> <https://github.com/discourse/discourse/blob/main/app/models/username_validator.rb>

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2020年八月10日 17:12 UTC](https://meta.discourse.org/t/what-are-the-discourse-rules-for-usernames/160367/3 "2020-08-10T17:12:32Z")

</div>

> [@abi\_at\_work](#):
>
> 我想确认一下是否允许在用户名中使用 & 和 ’ 符号。

不行，用户名中不能使用 `&` 或 `'`。如果用户尝试使用包含这些字符的用户名注册 Discourse 站点，他们将看到以下消息（`只能包含数字、字母、连字符、句点和下划线`）：

 ![image](https://global.discourse-cdn.com/meta/original/3X/6/3/637e6db62dafe2976410fcb9b09c106c18e3d901.png)

---

<div class="post-metadata">

### Author: ![abi\_at\_work](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/abi_at_work/32/189626_2.png) [@abi\_at\_work](https://meta.discourse.org/u/abi_at_work)
#### Post date: [2020年八月11日 07:52 UTC](https://meta.discourse.org/t/what-are-the-discourse-rules-for-usernames/160367/4 "2020-08-11T07:52:41Z")

</div>

谢谢 @pfaffman。我本来不确定这是否可配置，但看起来确实不可配置，这也解释了我为什么找不到相关选项。感谢您的回复。

我原以为可能在“允许用户名包含 Unicode 字符”的设置部分可以实现。
