Right now, i'm trying to create a PHP Regular Expression with these following conditions:
- Accepts all UTF-8 characters
- Space between words are allowed, how only 1 space and not multiple.
- Allow all symbols for example: !#$%^&*()_-={}[] except: "@"
- No trailing spaces after or before the string.
- Range should be 2-16 characters including spaces
- And must contain at least 2 letter characters in the string.
Here is the Regex I have drawn up so far:
/^(?=.{2,16}$)[^@\s]+(?:\h[^@\s]+)*$/um
So far this does all of the following except that it doesn't meet the last condition which is that it must contain at least 2 letters. For example:
"..He" //should be true
"He$*" //should be true
".." //should be false
"*%" //should be false
"!#$%^&*()" //should be false since there is no letters
"$$tonyMoney™" //should be true
"أنا أحب جا™" //should be true
"To" //should be true
Any help is appreciated! Thank you!