# Prohibit profanity in usernames

**URL:** <https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816>\
**Category:** Ask for Help\
**Created:** [June 2, 2024, 2:09pm UTC](https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816 "2024-06-02T14:09:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dias](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dias/32/75988_2.png) [@dias](https://community.glideapps.com/u/dias)\
**Post date:** [June 2, 2024, 2:09pm UTC](https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816/1 "2024-06-02T14:09:42Z")

</div>

Hey there!

I have the following check for specific characters which we allow in our usernames:

```auto
var regex = /^[a-zA-Z0-9-_]+$/;
 return regex.test(p1);

```

Does anyone know how I can implement a check for profanity? At the moment we just create users with the profane usernames and it blocks the username from being used because it’s already in use, but that’s using up our user table, and it isn’t very intuitive for the user to see that it’s just “in use” when changing their username.

This is what we currently do:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/8/f8b7a14c54535c610d475fbab5e4c3ccb3bef68e.png)  
The user tries to set the username to a blocked word, but sees it’s already taken and the app doesn’t allow them to change it.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/b/5b73dfb0d98315accb5fb73cc775d1ca9368fdb7.png)  
The user “Profanity” with the username “@profanity”

Thanks!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [June 2, 2024, 2:30pm UTC](https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816/2 "2024-06-02T14:30:05Z")

</div>

Rather than creating a user row for each name you don’t want, I think it would be better to create a comma delimited list of profane words and any variations. Then turn that list into an array using a Split Text column. Then you can check if the entered username is included in that list and/or the list is included in the username.

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [June 2, 2024, 2:42pm UTC](https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816/3 "2024-06-02T14:42:44Z")

</div>

As an alternative, you can use AI.

---

<div class="post-metadata">

**Author:** ![dias](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dias/32/75988_2.png) [@dias](https://community.glideapps.com/u/dias)\
**Post date:** [June 2, 2024, 2:47pm UTC](https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816/4 "2024-06-02T14:47:07Z")

</div>

> [@Himaladin](#):
>
> you can use AI.

How exactly would I be able to use AI? Does Glide AI have something like that?

---

<div class="post-metadata">

**Author:** ![Himaladin](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/himaladin/32/71023_2.png) [@Himaladin](https://community.glideapps.com/u/Himaladin)\
**Post date:** [June 2, 2024, 2:53pm UTC](https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816/5 "2024-06-02T14:53:50Z")

</div>

Robert Petito once demonstrated in his video the use of open AI in a Build AI chat. I haven’t tried Glide’s native AI for profanity.

You can see it around the 25 minute mark

[![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/a/ba246b2e29a0c9f1373a32e389593e035fcdb570.jpeg "Build No Code Private and AI Chats using the Glide Chat Component") ](https://www.youtube.com/watch?v=c0vW0GFc2io)

---

<div class="post-metadata">

**Author:** ![dias](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dias/32/75988_2.png) [@dias](https://community.glideapps.com/u/dias)\
**Post date:** [June 2, 2024, 3:38pm UTC](https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816/6 "2024-06-02T15:38:59Z")

</div>

This is what seemed to work best for me! Now, once an user tries to change their name to anything profane, vulgar, homophobic, transphobic, racist, sexist or other inappropriate things, my app will error out and won’t let the user change their username.

This is the prompt I used:

> Does this username contain any vulgarity or profanity, or does it have any homophobic, transphobic, racist, sexist or other innapropriate connotations? Things like “I’m gay” or “lesbian lover” shouldn’t count.

Thanks a lot! 😊

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [June 9, 2024, 3:39pm UTC](https://community.glideapps.com/t/prohibit-profanity-in-usernames/73816/7 "2024-06-09T15:39:42Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
