My task was to create a PHP file that will check a name coming from HTML GET and the basis are the following:
- It can be from a-z in small or capital letters
- 25 or less characters length
- Also add the TM Trademark as an exception
I don't know whether I will use REGEX or STRIPOS for this. My professor is asking me to write this in PHP. Some example scenarios:
1. AdriaN = allow
2. $tackoverFlow = not allowed
3. StackoverFl0w = allowed
4. ™ Stack Over Flow ™ = Allowed
5. StækOverFlow = not allowed
Here's what I have come up with so far, can this be improved upon?
$pattern = '/[a-zA-Z0-9\$\™]{1,24}$/';