> -----Original Message-----
> From: Jim [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 19 April 2006 10:52 AM
> To: beginners@perl.org
> Subject: Regex Help
> 
> 
> i am trying to match a '!' followed by any char but a '!' or no chars
> (string is only a '!')
> 
> this is what I have and it is not working:
> 
> $str = "!!";
> # this is not working.  it is matching "!!"
> print "$str\n" if $str =~ /\![^!]*/;
> 
> Thanks for any help
> 

maybe this ...



use strict;
use warnings;

while (<DATA>)
{
        print if ! /!.*(?=!)/;
}

__DATA__
!!
!a
!bcd
!!!!!!

__END__

--
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