"Dharshana Eswaran" schreef:

> m/^ #TAPI (?:_[A-Z]+)+ $/x
>
> But this is filtering both the strings starting from TAPI and the
> strings starting from #TAPI.

Yes, "#" starts a comment, so makes the regex equivalent to m/^/, which
will allways match.

  echo 'abc' |
    perl -nle '
      /^ # test/x and print 1
    '

Either an escaping backslash, or surrounding "[]", will change that:

  echo '#test' |
    perl -nle '
      /^ [#] test/x and print 1
    '

-- 
Affijn, Ruud

"Gewoon is een tijger."


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


Reply via email to