On 4/18/06, Jim <[EMAIL PROTECTED]> wrote:

> i am trying to match a '!' followed by any char but a '!' or no chars
> (string is only a '!')

This smells a little bit like homework. :-)

> print "$str\n" if $str =~ /\![^!]*/;

You don't have to backslash the bang, because it's not a metacharacter.

After the bang, you're asking for zero-or-more not-bang characters.
But what you want at that point is either a not-bang character or end
of string. To match the end of the string, use an anchor. (See
perlre.)

Does that give you enough to solve your problem? Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

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