Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

[SOLVED] How to restrict user name fields

  • Vorak
  • Vorak
  • OFFLINE
  • Posts: 218
  • Thanks: 41
  • Karma: 3
7 years 3 months ago - 7 years 2 months ago #296740 by Vorak
RE: www.joomlapolis.com/forum/153-professional-member-support/215798-how-to-restrict-user-name-fields#296740

Hello,

I came upon this topic when looking for the same solution.

I only want usernames to contain only letters (lowercase and uppercase) and numbers, not special charactes.

Is this still correct what I need to fill out in "Perl regular expression"? /[a-zA-Z0-9]*/

I'm just asking, because in the info tooltip it says:
only a+z + A+Z + digits: /^[0-9a-z]*$/i

So I'm wondering which one is the correct one? (In the tooltip, I also don't see capital A-Z even though it claims to be included for that code).

Thanks!

[MOD EDIT]: Please do not reply to 4 year old topics. Create a new topic and link to the previous topic if you feel it is relevant. As a general rule if the topic is 1 year or older do not reply and simply create a new topic. It pushes far too old of information to the top of the forums and search results.
Last edit: 7 years 2 months ago by krileon. Reason: Added [SOLVED] tag to subject

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
7 years 3 months ago #296776 by krileon
Replied by krileon on topic How to restrict user name fields
Yes, that is correct. the "i" modifier makes it case insensitive.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • Vorak
  • Vorak
  • OFFLINE
  • Posts: 218
  • Thanks: 41
  • Karma: 3
7 years 2 months ago #296847 by Vorak
Replied by Vorak on topic How to restrict user name fields
So both are equally correct codes then?

Sorry about the replying to an old topic - I hadn't paid attention to how old it was.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
7 years 2 months ago #296859 by krileon
Replied by krileon on topic How to restrict user name fields
Yes, you can use the "i" modifier or you can specify a-zA-Z to cover upper and lower case. See the below for REGEXP usage information.

www.regular-expressions.info/


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: Vorak

Please Log in or Create an account to join the conversation.

  • Vorak
  • Vorak
  • OFFLINE
  • Posts: 218
  • Thanks: 41
  • Karma: 3
7 years 2 months ago #296868 by Vorak
Replied by Vorak on topic How to restrict user name fields
In that case, I can keep the code I had put in.

Thanks for the information :)
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

  • Vorak
  • Vorak
  • OFFLINE
  • Posts: 218
  • Thanks: 41
  • Karma: 3
6 years 3 months ago #306548 by Vorak
Replied by Vorak on topic How to restrict user name fields
Hello,

I come back to this topic because I noticed recently that new users are able to register a username with a space in it. Because my website is linked with Moodle, which doesn't allow spaces in usernames, I need to avoid this from happening.

I assumed that my settings were set so that only letters and numbers were allowed and nothing else, but apparently that is not the case. These are my settings for the "username" field:

Authorized input: Custom Perl regular expression
Perl regular expression: /[a-zA-Z0-9]*/

Should I change hte Perl regular expression to something else? Or should I change the authorized input to single a-z,A-Z,0-9,_ word?

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum