<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 (.*)/ && $filter_pwds >= 1) {</div>
<div> ProcessHistory("ADMIN","","","#spi remote-address $1 spi-number $2 encrypted secret <removed> description $3\n");</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 <removed> description "REMOTE-1" </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"><<a href="mailto:scott.brynen@visioncritical.com" target="_blank">scott.brynen@visioncritical.com</a>></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:"Calibri","sans-serif";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:"Calibri","sans-serif";color:#1f497d">What you're looking for is:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> if (/#spi remote-address (.*) spi-number (.*) encrypted secret .* description (.*)/ && $filter_pwds >= 1) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> ProcessHistory("ADMIN","","","#spi remote-address $1 spi-number $2 encrypted secret <removed> description $3\n");<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> next;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Arial","sans-serif"">Scott Brynen</span></b><span style="font-family:"Arial","sans-serif";color:#1f497d"><br>
</span><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">Systems Operations Lead | Vision Critical</span><span style="font-family:"Arial","sans-serif";color:#1f497d"><br>
</span><span style="font-size:8.0pt;font-family:"Arial","sans-serif";color:#00b2e3">direct</span><span style="font-size:8.0pt;font-family:"Arial","sans-serif";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:"Arial","sans-serif";color:#00b2e3">mobile</span><span style="font-size:8.0pt;font-family:"Arial","sans-serif";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:"Arial","sans-serif";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:"Arial","sans-serif";color:#58595b">
</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <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've been lurking around the mailing list trying to find a solution to my issue. I'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 "REMOTE-1" <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's , and so far I've got the following to remove the encrypted key from the configuration which doesn'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 .* )/ && $filter_pwds >= 1) {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> ProcessHistory("ADMIN","","","#spi remote-address $1 spi-number $2 encrypted secret <removed> description $4 $5\n");<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 "REMOTE-1" spi-number encrypted secret <removed> description <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">i'm pretty sure i'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>