RegEx for no whitespace at the beginning and end
<p>I want to design an expression for not allowing whitespace at the beginning and at the end of a string, but allowing in the middle of the string.</p>

<p>The regex I've tried is this: </p>

<pre><code>\^[^\s][a-z\sA-Z\s0-9\s-()][^\s$]\
</code></pre>