in reply to Re: Parsing a file
in thread Parsing a file

This is so weird. I rid of the colon and it doesn't crash, but it doesn't print or find anything. An exact copy of my log file is
Paltalk: This is a G rated voice group intended for a General Audience + including minors. Offensive language is not permitted. To speak, h +old the ctrl key down. ladymindy: gu ladymindy: jo ladymindy: hi pixelatedcyberdust: hi Alberta226: ((((( LM )))))) ladymindy: ((((((much)))))) ladymindy: i can t read ladymindy: (((((((alkberta)()))))) eartistp: hey pixels awake too eartistp: can't type either today lol pixelatedcyberdust: yep, very awake Alberta226: much is here ???

Replies are listed 'Best First'.
Re^3: Parsing a file
by Nkuvu (Priest) on Jan 22, 2004 at 20:27 UTC
    If you're using this code:
    while(my $message = <FILE>) { print "$1: $2<br/>" if /^(Alberta226: )([a-zA-Z, 0-9])+/; # I added the + }

    you'll need to fix one little thing. The lines from FILE are being assigned to $message but the regex is matching against $_

    So you could do this as
    while(<FILE>) { print "$1: $2<br/>" if /^(Alberta226: )([a-zA-Z, 0-9])+/; }

    or
    while(my $message = <FILE>) { print "$1: $2<br/>" if $message =~/^(Alberta226: )([a-zA-Z, 0-9])+/; }