Perl: the Markov chain saw | |
PerlMonks |
Re: Misunderstanding negative look behindby moritz (Cardinal) |
on May 30, 2012 at 12:26 UTC ( [id://973276]=note: print w/replies, xml ) | Need Help?? |
You never show where exactly in a regex you insert your look-behind, so I can only get what you're doing wrong. If you put it at the start of a regex, you need to a negative look-ahead, because the IP address is not yet matched. Example:
Produces the output:
Note that this uses the negative look-ahead directly after the ^ anchor, so that the look-ahead never backtracks. I would like to delete all those records which contain the host name (qualified or unqualified), but don't start with the right address of the machine It is much easier to do such a check after you have parsed the line, and extracted host name and IP address.
In Section
Seekers of Perl Wisdom
|
|