On Tue, May 10, 2011 at 04:55:25PM -0400, Robert Huttinger wrote:
> I thought I had gotten it to ignore those words. so anything that looked
> like
> :link || :active etc ignore those lines.
Okay, you could do something like this:
#! /usr/bin/perl
use strict;
use warnings;
while (<>){
s/^([-a-z ]+:)(?!link|visited|hover|active)\s*(.+)/sprintf("%-20s",$1) .
"$2"/ie;
print;
}
(?!...) is a negative-lookahead assertion. It makes sure the sub-pattern
doesn't match at that point in the string, without consuming any of the
string.
However, if you can assume that a :selector will always be followed by a {
on the same line, then this might be better:
while (<>){
s/^([-a-z ]+:)\s*([^\{]+)$/sprintf("%-20s",$1) . "$2"/ie;
print;
}
Ronald
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>