title: How to remove part of a string in powershell using Regular Expressions
body: <p>I am struggling with a regular expression that I can't figure out:</p>
  
  <p>My string is like this</p>
  
  <pre><code>Y
  
  [sudo] Password for user: Other Text here
  even more text here: with more text
  </code></pre>
  
  <p>My goal is to select all the text from the first line up to and including the first ': ' and to replace it with nothing.</p>
  
  <p>Problem is that the first two lines might or might not be present, and it would still have to select the text up to and including the first occurrence of ': '</p>
  
  <p>My end result should look like:</p>
  
  <pre><code>Other Text here
  even more text here: with more text
  </code></pre>
  
  <p>This is what I got, but now I am stuck:</p>
  
  <pre><code>$Test[0..3] -replace ('[a-zA-Z]+\w\:*\s')
  </code></pre>
  
  <p>But that leaves line 0 and line 1 and doesn't get rid of [sudo] either :(</p>
  
  <p>Hope a regex wiz can give me some insight :)</p>
  
  <p><em>EDIT</em>
  Some more info on the actual string (which is very long and contains a unix log file):</p>
  
  <pre><code>C:\&gt; $MainArray
  y
  
  [sudo] password for User: 1485673353 1 33412 2 appxxx 1801152 1801047 0 appxxx bptm image copy is not ready, retry attempt: 6 of 500 o
  bject is busy, cannot be closed
  1485673354 1 33412 2 appxxx 1801153 1801047 0 appxxx bptm image copy is not ready, retry attempt: 6 of 500 object is busy, cannot be closed etc. etc.
  </code></pre>
  
  <p>Trying the first answer:
   C:> $MainArray -replace ('^[^:]+?:\s*')</p>
  
  <pre><code>y
  
  1485676476 1 4 4 appxxx 1801540 1801213 0 appxxx bptm successfully wrote backup id appxxx_1485671817, copy 1, fragment 17, 51200000
  </code></pre>
  
  <p>It somehow doesn't delete the first two lines (the y  and the RETURN)</p>