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$
Non-spaces, optionally followed by multiple groups of spaces then non-spaces:
^[^\s]+(\s+[^\s]+)*$
Edit:
To include the character restrictions, just replace non-space classes with allowable characters:
^[-_a-zA-Z0-9]+(\s+[-_a-zA-Z0-9]+)*$
Also, consider being Unicode friendly and using something like
^[-_\p{Alnum}]+(\s+[-_\p{Alnum}]+)*$
(assuming your regex interpreter allows it).