Jay Savage wrote:
> On 8/11/05, Alex <[EMAIL PROTECTED]> wrote:
>>>Also, correction posted by Jay, is not applicabile because we have more
>>>lines containing "Virus" word and only one should be counted (***** Virus).
>>>
>>And for posterity, i am answering myself:
>>
>> elsif($prog eq 'hook') {
>> # Vexira antivirus
>> if($text =~ /^[\*]+ Virus\b/) {
>> event($time, 'virus');
>> }
>> }
>
> Close. That will also pick up \*\*\*\*\*\*\*\ Virus, \\\\\\\\\\\\\\\\
> Virus, etc. /[\*]+/ captures one or more '\' and/or '*', because
> metacharacters lose their meanings inside [], except an initial '^',
> which gets a completely different meaning. you want:
Well that is almost correct. Because the match and substitution
operators behave like double quoted strings the backslash will be
interpolated.
$ perl -le'
for ( qw[ aaa\aaa bbb*bbb cccccc ] ) {
print $_, /[\*]/ ? " matched" : " did not match"
}
'
aaa\aaa did not match
bbb*bbb matched
cccccc did not match
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>