Hello everyone,

I have the following regular expressions that I'm performing on a block
of text and was wondering if anyone saw a way to consolidate the 9
regex's into a few?

$ko =~ s/\r/\\page/g; # change returns to \page
$ko =~ s/\f//g; # remove formfeeds
$ko =~ s/\t/\\tab/g; # change tabs to \tab
$ko =~ s/\\\\/\\/g; # escape backslashes
$ko =~ s/{/\\{/g; # escape left curly
$ko =~ s/}/\\}/g; # escape right curly
$ko =~ s/\n/\n\\par /g; # replace newlines with \n\par
$ko =~ s/\\par\s+\n\\par\s+\n\\par\s+\n+/\\par \n/migs; # cosolidate
"blank" lines
$ko =~ s/\\f0\\fs22\n\\page/\\f0\\fs22\n\\par /migs; # remove first page
break

This is not so much for laziness, but is more for learning what/how to
consolidate.

Any suggestions are appreciated.

Kevin
-- 
Kevin Old <[EMAIL PROTECTED]>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to