title: PowerShell Replace Regex
body: <p>I have a <code>select-string</code> which is searching an IIS log for a particular string and returning the 2 lines above and one line below.</p>
  <p>Results look like this:</p>
  <pre class="lang-none prettyprint-override"><code>2012-06-15 18:26:09 98.138.206.39 OutboundConnectionResponse SMTPSVC1 WEB10 - 25 - - 220+mta1083.sbc.mail.ne1.yahoo.com+ESMTP+YSmtp+service+ready 0 0 60 0 218 SMTP - - - -
  2012-06-15 18:26:09 98.138.206.39 OutboundConnectionCommand SMTPSVC1 WEB10 - 25 EHLO - WEB10.DOMAIN&gt;COM 0 0 4 0 218 SMTP - - - -
  &gt; 2012-06-15 18:26:09 74.125.244.10 OutboundConnectionResponse SMTPSVC1 WEB10 - 25 - - 550+IP+Authorization+check+failed+-+psmtp 0 0 41 0 218 SMTP - - - -
  2012-06-15 18:26:09 74.125.244.10 OutboundConnectionCommand SMTPSVC1 WEB10 - 25 RSET - - 0 0 4 0 218 SMTP - - - - 
  </code></pre>
  <p>Note the third line begins with <code>&gt;</code> denoting that's the line that <code>select-string</code> matched upon.</p>
  <p>I am trying to do a <code>-replace</code> on the <code>&gt;</code> to replace it with <code>&lt; font color=&quot;red&quot;&gt;$1&lt; /font&gt;</code> but my replace doesn't seem to work.</p>
  <p>Here's my code:</p>
  <pre><code>$results = $results -replace &quot;(^&gt; )(.*)$&quot;, &quot;&lt; font color='red'&gt;$1&lt; font&gt;&quot; 
  </code></pre>
  <p>Can any PowerShell regex gurus out there tell me why my regular expression isn't matching?</p>