Jump to content

Profile fields - How to force minimum number of characters i


Recommended Posts

  • 1 month later...

Am I the only one who's experienced new members avoiding filling in a required profile field by entering a single character or a space, or is there really no solution to this?

I don't know regex, but if someone might what the regex might be to force a minimum number of characters in a profile text field, I'd be very grateful! 

Link to comment
Share on other sites

I only know a really tiny bit of regex. I forgot the profile fields have an option to enter regex to check the value entered, hence my question.

Testing it on the link you gave, it works great, thanks so much!

I've got a few regex sites bookmarked, but hadn't seen that page before, so thanks for that too.

Link to comment
Share on other sites

A tip for anyone trying this. When I tried entering:


as I want a minimum of 1 word containing 4 characters, I was met with a “That value is not allowed” message, despite knowing it should work.

Some searching on this forum indicated that I might need to add a "/" in front of and at end of the regex, eg:


I tried that and it then worked.

My only quibble with this is the phrase “That value is not allowed”, which is shown to members if they try to leave the field empty or enter a full-stop, etc. They won't understand what's meant by "value". I can't change (translate) it in languages, as that term is used for all sorts else that's related to various "forms".


Link to comment
Share on other sites

  • 2 weeks later...

Hmmm... it didn't work... I have 2 profile fields that are required during registration. Somebody registered today and entered 2 characters and it was accepted. I don't know why the regex is now not working, as it worked before when I tested it myself as a guest pretending to register.

Any ideas, please?

Link to comment
Share on other sites

There are no non-breaking or any other invisible characters. I've no problem linking to the user's profile, they've successfully registered.

The values are the ones mentioned earlier in this topic. I tried it again as a guest pretending to register. The regex works fine for the first one, but not for the second one.

This is the first field:


This is the 2nd field:


The difference between the two is that one is a "Text" type with a limit of 150 characters and the other is a "Text Area" type with a higher character limit.

The member entered a 4 character word for the 1st field, and entered "N/A" for the 2nd one.

But, like I said, when I first did these and tested them, they both worked fine. So I don't understand why the 2nd one now doesn't and even allows it to be blank; it's acting as if it weren't required?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...