Regular expression for no white space at start or end, but allow white space in middle, but also allow only one char inputs:
The closest I have got is : ^([^\\
^([^\\
Make everything after the first non-space character optional:
^(?=\S)[a-zA-Z0-9_\s-]*\S$