# Username preceded by @ detected as email

**URL:** https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355
**Category:** Bug
**Created:** [October 3, 2017, 3:09pm UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355 "2017-10-03T15:09:29Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [October 3, 2017, 3:09pm UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/1 "2017-10-03T15:09:29Z")

</div>

@zogstrip I can’t upgrade without the rebuild now (there’s a docker\_manager upgrade to do so the rebuild is mandatory and I have to wait tonight to do that).

I was wondering if you even fixed the error that appears when trying to type a username preceded by `@`

 ![CdYJFZM](https://global.discourse-cdn.com/meta/original/4X/6/d/4/6d49e973a85383103557481d26f94ae487c042ec.png)  
A message icon appears before the username (why?), no list of users appears when I’m typing.  
I’m still on v1.9.0.beta11 +33 and all works well (no errors) until I type usernames without `@` otherwise I get the error “There was an error changing the ownership of the post”.

I see that the message icon appears even when I try to add users in a group if I type `@` (The requested URL or resource could not be found.)

Imho, adding usernames without or with `@` should be allowed the same way, with no errors.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [October 3, 2017, 3:11pm UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/2 "2017-10-03T15:11:20Z")

</div>

I did not fix that. The 📧 is used to designate an email address. I think it’s a bug since it’s should at least have one character before the **`@`**.

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [April 20, 2018, 10:35am UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/3 "2018-04-20T10:35:13Z")

</div>

Fixed via

> <https://github.com/discourse/discourse/commit/116ddec22e35f5ae9cc32ac4c348a91e6cb6450d>
>
> https://meta.discourse.org/t/cant-add-members-to-a-group/85738?u=tgxworld

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [April 20, 2018, 10:35am UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/4 "2018-04-20T10:35:17Z")

</div>



---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [April 24, 2018, 11:54pm UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/5 "2018-04-24T23:54:06Z")

</div>

> `options.term.match(/@/)`

@tgxworld shouldn’t this regex be something more like `.@` or `(?!^)@` ? i.e. requiring a non-empty local part for the email address

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [April 26, 2018, 1:50am UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/6 "2018-04-26T01:50:53Z")

</div>

Good point. @nbianca Could you have a look at the regexp used here?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [April 26, 2018, 5:41am UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/7 "2018-04-26T05:41:42Z")

</div>



---

<div class="post-metadata">

### Author: ![nbianca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nbianca/32/157984_2.png) [@nbianca](https://meta.discourse.org/u/nbianca)
#### Post date: [May 6, 2018, 8:55am UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/8 "2018-05-06T08:55:02Z")

</div>

Hi @tgxworld,

I submitted [PR #5804](https://github.com/discourse/discourse/pull/5804) to fix this.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [June 12, 2018, 8:22am UTC](https://meta.discourse.org/t/username-preceded-by-detected-as-email/71355/9 "2018-06-12T08:22:20Z")

</div>


