# Can I restrict specific strings in usernames?

**URL:** https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528
**Category:** Support
**Created:** [September 21, 2017, 5:23pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528 "2017-09-21T17:23:53Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [September 21, 2017, 5:23pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/1 "2017-09-21T17:23:53Z")

</div>

We have standardized on a specific naming convention for staff on our forum. Is it possible to restrict a specific substring in a username to prevent other users from using it? It is a **very** specific string that could not be used inadvertently.

---

<div class="post-metadata">

### Author: ![MakaryGo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/makarygo/32/187426_2.png) [@MakaryGo](https://meta.discourse.org/u/MakaryGo)
#### Post date: [September 21, 2017, 5:29pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/2 "2017-09-21T17:29:35Z")

</div>

You have option in settings: reserved usernames, but I don’t know if ot accepts regexes.

---

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [September 21, 2017, 5:39pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/3 "2017-09-21T17:39:09Z")

</div>

Got it. 🤦‍♂️

I just used \*+myreserved string and it works just fine.

---

<div class="post-metadata">

### Author: ![MakaryGo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/makarygo/32/187426_2.png) [@MakaryGo](https://meta.discourse.org/u/MakaryGo)
#### Post date: [September 21, 2017, 6:16pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/4 "2017-09-21T18:16:15Z")

</div>

Always happy to help

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [September 21, 2017, 9:13pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/5 "2017-09-21T21:13:15Z")

</div>

> [@jordan1909](#):
>
> I just used \*+myreserved string

To be clear: you are saying that putting `*blah` into `reserved usernames` results in oneblah not being allowed as a new user name?

---

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [September 21, 2017, 11:23pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/6 "2017-09-21T23:23:32Z")

</div>

Worked perfectly for me. I entered \*\_ companyref (note the\_is included. We use\_company to denote staff in naming) . I then tried to create an account with approx. 30 different usernames with this naming convention and each time I was told it wouldnt work.

So short answer, yes worked perfect for me.

---

<div class="post-metadata">

### Author: ![jcoates](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jcoates/32/78029_2.png) [@jcoates](https://meta.discourse.org/u/jcoates)
#### Post date: [September 22, 2017, 4:02am UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/7 "2017-09-22T04:02:11Z")

</div>

> [@jordan1909](#):
>
> I just used \*+myreserved string and it works just fine.

Shouldn’t it be `*mystring*` to avoid people using something like “MikeMYSTRINGstaff”?

---

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [September 22, 2017, 12:25pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/8 "2017-09-22T12:25:04Z")

</div>

So possibly but I actually don’t care if the substring exists in the middle. I am more so determining the ending. So for example on our site this would be the case:

John\_company != allowed  
john\_companyAsdf == allowed  
john\_company\_john == allowed

So I don’t necessarily mind if the substring exists in the begining or middle or if there are different variations it is more so ensuring users cannot use our identifier at the end of a username.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:44pm UTC](https://meta.discourse.org/t/can-i-restrict-specific-strings-in-usernames/70528/9 "2024-06-08T12:44:17Z")

</div>

This topic was automatically closed after 2451 days. New replies are no longer allowed.
