<div dir="ltr">Thank you Scott for pointing me in the right direction. Taking your example I tweaked this a little which looks like it worked. The final regex looks like:<div><br></div><div><div>      if (/\s+spi remote-address (.*) spi-number (.*) encrypted secret .* description (.*)/ &amp;&amp; $filter_pwds &gt;= 1) {</div>
<div>            ProcessHistory(&quot;ADMIN&quot;,&quot;&quot;,&quot;&quot;,&quot;#spi remote-address $1 spi-number $2 encrypted secret &lt;removed&gt; description $3\n&quot;);</div><div>            next;</div><div>        }</div>
</div><div><br></div><div style>and the configuration now looks like:</div><div style><br></div><div style><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">#spi remote-address <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;white-space:normal">192.168.3.50</span> spi-number 256 encrypted secret &lt;removed&gt; description &quot;REMOTE-1&quot; </pre>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 20, 2013 at 8:46 AM, Scott Brynen <span dir="ltr">&lt;<a href="mailto:scott.brynen@visioncritical.com" target="_blank">scott.brynen@visioncritical.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">The $1 is matching the entire matched string because you put () around the whole thing<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">What you&#39;re looking for is:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">       if (/#spi remote-address (.*) spi-number (.*) encrypted secret .* description (.*)/ &amp;&amp; $filter_pwds &gt;= 1) {<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">            ProcessHistory(&quot;ADMIN&quot;,&quot;&quot;,&quot;&quot;,&quot;#spi remote-address $1 spi-number $2 encrypted secret &lt;removed&gt; description $3\n&quot;);<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">            next;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">        }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;">Scott Brynen</span></b><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d"><br>
</span><span style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">Systems Operations Lead | Vision Critical</span><span style="font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d"><br>

</span><span style="font-size:8.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#00b2e3">direct</span><span style="font-size:8.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#58595b"> <a href="tel:%2B1.604.638.9804" value="+16046389804" target="_blank">+1.604.638.9804</a>
</span><span style="font-size:8.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#00b2e3">mobile</span><span style="font-size:8.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#58595b"> <a href="tel:%2B1.778.788.0543" value="+17787880543" target="_blank">+1.778.788.0543</a>
<br>
</span><span style="font-size:8.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#00b2e3">web
<a href="http://www.visioncritical.com" target="_blank"><span style="font-size:10.0pt;color:blue">visioncritical.com</span></a></span><span style="font-size:8.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#58595b">
</span><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:rancid-discuss-bounces@shrubbery.net" target="_blank">rancid-discuss-bounces@shrubbery.net</a> [mailto:<a href="mailto:rancid-discuss-bounces@shrubbery.net" target="_blank">rancid-discuss-bounces@shrubbery.net</a>]
<b>On Behalf Of </b>Khurram Khan<br>
<b>Sent:</b> Wednesday, February 20, 2013 2:18 AM<br>
<b>To:</b> <a href="mailto:rancid-discuss@shrubbery.net" target="_blank">rancid-discuss@shrubbery.net</a><br>
<b>Subject:</b> [rancid] Help with Removing encrypted secret<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hello All,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I&#39;ve been lurking around the mailing list trying to find a solution to my issue. I&#39;m trying to grab configuration from a Cisco ASR5000 which contains the configuration in the form of:<u></u><u></u></p>

</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">spi remote-address 192.168.3.50 spi-number 256 encrypted secret ba8533de9d50051d04c124ccebb16563 description &quot;REMOTE-1&quot; <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Regex is not one of my forte&#39;s , and so far I&#39;ve got the following to remove the encrypted key from the configuration which doesn&#39;t seem to be working<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">       if (/(\s+spi remote-address (.*) spi-number (.*) encrypted secret .* description .* )/ &amp;&amp; $filter_pwds &gt;= 1) {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            ProcessHistory(&quot;ADMIN&quot;,&quot;&quot;,&quot;&quot;,&quot;#spi remote-address $1 spi-number $2 encrypted secret &lt;removed&gt; description $4 $5\n&quot;);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">            next;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">        }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">the result that I get in the configuration looks like:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">#spi remote-address       spi remote-address 192.168.3.50 spi-number 256 encrypted secret ba8533de9d50051d04c124ccebb16563 description &quot;REMOTE-1&quot;  spi-number  encrypted secret &lt;removed&gt; description <u></u><u></u></p>

</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">i&#39;m pretty sure i&#39;m missing something in regex. If someone could point me in the right direction, I would really appreciate it. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thank you in advance!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br>- kk
</div>