i'd suggest the squish tr that uri put out.<br><br>otherwise,<br><br>$exp =~ s/\r+/\n/g;<br>$exp =~ s/(\s)\1+/\1g;<br><br>note the use of + instead of *.<br><br>the second s will not match repeated \r\n, which is probably what you have.<br>
<br><div class="gmail_quote">On Sat, Oct 27, 2012 at 7:42 PM, Rob Janes <span dir="ltr"><<a href="mailto:janes.rob@gmail.com" target="_blank">janes.rob@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Slurp the file and run the second regex.</p>
<p dir="ltr">undef $/;<br>
$exp = <in>;<br>
$exp =~ s/(\s)\1+/\1/g;</p>
<p dir="ltr">Not sure $/.</p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Oct 27, 2012 6:48 PM, "Chris Jones" <<a href="mailto:cj@enersave.ca" target="_blank">cj@enersave.ca</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Progress:<br>
<br>
An example of the text I am trying to regex:<br>
Expression:<br>
if(Local(TYPE) == 1) then<br>
1.25<br>
<br>
else<br>
UNCHANGED<br>
endif<br>
<br>
I would like:<br>
Expression after:<br>
if(Local(TYPE) == 1) then<br>
1.25<br>
else<br>
UNCHANGED<br>
endif<br>
<br>
$Expression =~ s/(\s)\1*/\1/g; #gives me:<br>
if(Local(TYPE) == 1) then<br>
1.25<br>
<br>
else<br>
UNCHANGED<br>
endif<br>
<br>
But I can't figure out how to match the double carriage return?<br>
<br>
At 07:55 PM 23/10/2012, Stuart Watt wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 2012-10-23, at 2:32 PM, Chris Jones <<a href="mailto:cj@enersave.ca" target="_blank">cj@enersave.ca</a>> wrote:<br>
<br>
> My tests are working correctly, I don't try to delete directories.<br>
><br>
> My follow on question is how do you tell File:Find to skip the directory the script is called from. I only want to delete files in the sub-directories.<br>
><br>
> I can test each file to see if it's directory is '.' but would seem somewhat inefficient?<br>
<br>
String matching efficiency is probably a thousand times higher than file system accesses, so if I was you I really wouldn't worry about it. I tend to use no_chdir => 1 and $File::Find::name, but to skip everything in the base directory, probably checking to see if $File::Find::dir is the same as the base should be quick and effective.<br>
<br>
All the best<br>
Stuart<br>
______________________________<u></u>_________________<br>
</blockquote>
<br>
>><br>
Christopher Jones, P.Eng.<br>
Suite 1801, 1 Yonge Street<br>
Toronto, ON M5E1W7<br>
Tel. <a href="tel:416-203-7465" value="+14162037465" target="_blank">416-203-7465</a><br>
Fax. <a href="tel:416-946-1005" value="+14169461005" target="_blank">416-946-1005</a><br>
email <a href="mailto:cj@enersave.ca" target="_blank">cj@enersave.ca</a><br>
<br>
______________________________<u></u>_________________<br>
toronto-pm mailing list<br>
<a href="mailto:toronto-pm@pm.org" target="_blank">toronto-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/toronto-pm" target="_blank">http://mail.pm.org/mailman/<u></u>listinfo/toronto-pm</a><br>
</blockquote></div>
</div></div></blockquote></div><br>