title: Replace only leading and trailing whitespace with underscore using regex in c#
body: <p>I want to replace only leading and trailing white space of a string by number of underscore.</p>
  
  <p><strong>Input String</strong></p>
  
  <pre><code>" New Folder  "
  </code></pre>
  
  <p>(Notes: There is one white space at front and two white spaces at the end of this string)</p>
  
  <p><strong>Output</strong></p>
  
  <p>My desire output string <code>"_New Folder__"</code><br>
  (The output string has one underscore at the front and two underscore at the end.)</p>