DOH,
I would have sworn I did have a question mark in there. At one point
anyway.
Thanks Rob,
Jonathan
On 12/7/02 8:17 AM, "Rob Dixon" <[EMAIL PROTECTED]> wrote:
> Hello Jonathan
>
> It's because the regex /^.*\@/g finds the _last_ @ in the record, which
> isn't followed by 'domain'. The .* will consume as many characters as it can
> as long as the rest of the regex is satisfied.
>
> If you were to do it like this, you'd use /^.*?\@/g because .*? matches as
> few characters as possible. But it will work fine as
>
> if (/@/g) { .. }
>
> HTH,
>
> Rob
>
>
>
>
> ----- Original Message -----
> From: "Jonathan Daniels" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, December 07, 2002 12:32 AM
> Subject: This perl script does nothing....
>
>
>> > Hi,
>> >
>> > Hopefully this isn't too stupid of a question. Thanks in advance for any
>> > help.
>> >
>> > Can anyone tell me why, when I feed a file of the following format
>> >
>> >
> Date,Time,Action,Result,Client,Server,From,To,To,To,...,Subject,Size,SMTPID
>> >
>> > 20021128,9,Message Accepted,,10.0.0.1,,[EMAIL PROTECTED],[EMAIL PROTECTED],...
>> >
>> > This type of line many more times....
>> >
>> > To the following script it does nothing. Nothing at all. No errors, just
>> > returns to the command prompt.
>> >
>> >
>> > #!/usr/bin/perl
>> >
>> > while (<>){
>> >
>> > chomp;
>> >
>> > if (/^.*\@/g){ # find the first @ remember where it is.
>> >
>> > if (/\G(domain)/i){ #go back and look for domain
>> >
>> > print ; #if you find domain print the line.
>> > }
>> >
>> > }
>> >
>> > else{
>> >
>> > print "No Match.\n";
>> >
>> >
>> > }
>> >
>> > }
>> >
>> >
>> >
>> > Thanks,
>> >
>> > Jonathan
>> >
>> >
>> >
>> > --
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>
>