[ale] perl regex.... again
Geoffrey Myers
lists at serioustechnology.com
Tue Mar 1 06:54:37 EST 2011
Pat Regan wrote:
> On Mon, 28 Feb 2011 16:44:13 -0500
> "Michael H. Warfield" <mhw at wittsend.com> wrote:
>
>> Yeah, strong suspicion you can not do \OOO inside a regex. From the
>> man page:
>>
>> man 7 regex
>>
>> ==
>> ... all other special characters, including '\', lose their special
>> significance within a bracket expression.
>> ==
>
> Ah, pants. I just assumed it would work. The syntax sure looked
> right!
>
> This seems to work pretty well on some random text files. It might be
> missing some characters he wants to match, but it should be a good
> start:
>
> perl -ne 'if(/[^[:alnum:][:punct:]\s]/) {print "bad line:$_\n";}'
Okay, I don't know what I was doing last night, but now, I get this to
work as well:
($_ =~ /[^[:print:]]/) && print "<$_> bad\n";
>
> Pat
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
--
Until later, Geoffrey
"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson
More information about the Ale
mailing list