Can I actually put array and regex in validation field? Having big trouble to compose this:
- Can’t contain spaces
- Must begin with a letter
- Can only contain letters, numbers, and the special characters hyphen ( - ), underscore ( _ ), and period ( . ), EXCEPT that the username:
- Can’t begin with a number, hyphen, underscore, or period
- Can’t end with a hyphen, underscore, or period
- Can’t contain emojis or other symbols such as @, $, #, etc.
along with my other requirements I've already covered:
string| min:3| max:15
I've heard that I can't use a pipe character while using regex so tried to make an array:
array(
'string' ,
'min:3' ,
'max:15' ,
'regex:[^0-9]'
)
However it does not seem to work ;/
EDIT
Actually googled regex which should cover all requirements:
[a-z][0-9a-z\-_\.]{1,13}[0-9a-z]
I think that it should be formated in validation field as that:
regex:[a-z][0-9a-z\-_\.]{1,13}[0-9a-z]
But it still does not work. What am I doing wrong?
EDIT.2
I finally worked it out on my own. Posting it in case someone ever needs something similiar.
regex:/(^[a-zA-Z][\w-_.]{1,13}[\w]$)/