in reply to Re: Strange Behavior while Parsing Sendmail logs
in thread Strange Behavior while Parsing Sendmail logs

It does no good to have an unanchored .* at both ends. but it does because regexps are greedy (by default). If they weren't there, the substitution would do nothing, it would just put $1 back where it found it. But the .* cause the whole line to be matched, and thus *only* the $1 is put back in. that said it is no doubt safer to anchor such a regex
  • Comment on RE: Re: Strange Behavior while Parsing Sendmail logs

Replies are listed 'Best First'.
RE: RE: Re: Strange Behavior while Parsing Sendmail logs
by tye (Sage) on Jul 19, 2000 at 06:44 UTC

    Sorry, you are right.

    I think I was thinking ahead to the change I made to just match against the line and just assign $1 to the variable. Mea culpa.