<html>
<body>
<blockquote type=cite class=cite cite="">
<dl><br>
</dl><br>
You don't need \r\n ... \n is sufficient:<br><br>
"\n matches a logical newline. Perl
converts between \n and your<br>
OS's native newline character when
reading from or writing to text <br>
files."<br>
'Character Escapes' <br>
in
<a href="http://perldoc.perl.org/perlrebackslash.html">
http://perldoc.perl.org/perlrebackslash.html</a><br><br>
Also, do you want to wind up with either a space or a newline,
accidentally, depending on which one came first? <br><br>
Consider "line 1 \n \nline
3" collapsing into "line1 line 3"<br>
compared to "line 1\n \nline 3" collapsing into
"line1\nline 3"<br>
just because of a trailing space.<br><br>
</blockquote><br>
Apparently Microsoft didn't inform Perl that the access database uses
\r\n in the memo field. <br>
$exp =~ s/(\s|\n)\1+/$1/g;<br>
"Expression 1:","if(Local(TYPE) == 1) then<br>
1.25<br><br>
else<br>
UNCHANGED<br>
endif",<br><br>
"Expression 2:","if(Local(TYPE) == 1) then<br>
1.25<br><br>
else<br>
UNCHANGED<br>
endif"<br><br>
Adding the \r produces the desired output:<br>
s/(\s|\r\n)\1+/$1/g;<br>
"Expression 1:","if(Local(TYPE) == 1) then<br>
1.25<br><br>
else<br>
UNCHANGED<br>
endif",<br><br>
"Expression 2:","if(Local(TYPE) == 1) then<br>
1.25<br>
else<br>
UNCHANGED<br>
endif"<br>
<x-sigsep><p></x-sigsep>
>><br>
Christopher Jones, P.Eng.<br>
Suite 1801, 1 Yonge Street<br>
Toronto, ON M5E1W7<br>
Tel. 416-203-7465<br>
Fax. 416-946-1005<br>
email cj@enersave.ca<br>
</body>
</html>