06-20-2014 03:18 AM
Darin.K wrote:2. Using my regex helper means I do not even have to worry about it or remembering the exact syntax of any of the posix classes.
What is your regex helper, please?
06-20-2014 06:36 AM
06-20-2014 06:49 AM
@Darin.K wrote:
Missed the requirements:
single regex:
^([[:alpha:]]+[[:digit:]]+|[[:digit:]]+[[:alpha:]])[[:alnum:]]*$
You either have 1 or more digits followed by 1 or more letters or 1 or more letters followed by 1 or more digits. Once that is out of the way, the rest of the string must be all alphanumerics. The ^ and $ make sure the whole string is included in the match.
(I have not tested this at all, just typed it up hopefully I got all the brackets in the right place).
When I copied your regex and pasted it into a string constant, I got ^([[:alpha:]]+[[:digit:]]+|[[:digit:]]+[[:alpha:]]?)[[:alnum:]]*$, but the question mark disappears when I paste it into this response. Weird.
Anyway, the question mark needs to be a "+" and it'll work.