title: regular expression to remove the first word of each line
body: <p>I am trying to make a regular expression that grabs the first word (including possible leading white space) of each line.  Here it is:</p>
  
  <pre><code>/^([\s]+[\S]*).*$/\1//
  </code></pre>
  
  <p>This code does not seem to be working (see <a href="http://regexr.com?34o6m" rel="nofollow">http://regexr.com?34o6m</a>).  The code is supposed to</p>
  
  <ol>
  <li>Begin at the start of the line</li>
  <li>Create a capturing group where it places the first word (with possible leading white space)</li>
  <li>Grab the rest of the line</li>
  <li>Substitute the entire line with just the inside of the first capturing group</li>
  </ol>
  
  <p>I tried another version also:</p>
  
  <pre><code>/\S(?&lt;=\s).*^//
  </code></pre>
  
  <p>It looks like this one fails too (<a href="http://regexr.com?34o6s" rel="nofollow">http://regexr.com?34o6s</a>).  The goal here was to</p>
  
  <ol>
  <li>Find the first non-whitespace character.</li>
  <li>Look behind to make sure it has a whitespace character behind it (i.e. not the first letter of the line).</li>
  <li>Grab the rest of the line.</li>
  <li>Erase everything the expression just grabbed.</li>
  </ol>
  
  <p>Any insight to what is going wrong would be greatly appreciated.  Thanks!</p>