XF 1.5 Regex for 5 different characters

Alpha1

Well-known member
Licensed customer
I want to force my members to type at least 5 different characters in a custom user field. Is there a regex statement I can use?
 
Give this a go

/^[a-zA-Z0-9 ]{5,}$/

or

^[a-zA-Z0-9 ]{5,}$

Tested here https://regex101.com/r/sN7tX4/4

matches alphanumeric (and space), must match 5 or more times before the end of the string

Test it, I'm just guessing, I haven't used regex on custom fields, and regex isn't my strongest point (it drives me crazy)
 
Last edited:
This doesn't prevent character re-use, but that quickly becomes an insane regex (but should be vaguely doable with backreferences)
 
I want to force my members to type at least 5 different characters in a custom user field. Is there a regex statement I can use?
What is the exact formula you need.

Is what you wrote the only considerations, what are the limitations for characters (alpha, numeric, are they case sensitive where "A" and "a" are different)?
 
Back
Top Bottom