on Fri, 14 Jun 2002 05:42:04 GMT, [EMAIL PROTECTED] (Langa
Kentane) wrote: 

> Greetz,
> I need some help with IP address matching. For instance I have a
> log with an IP address 10.3.2.1 and 10.3.4.5. I want to match all
> IP addresses in the 10.3.0.0 mask 255.255.0.0 range. How would I
> do this? 

Your problem is greatly simplified by the fact that you don't want to 
*validate* IP-adresses, but just find valid ones in a logfile:

        /10\.3\.\d{1,3}\.\d{1,3}/

> 
> Another thing is I would like to match any IP address on the log
> file for instance I have a log and the IP address could appear
> anywhere on the line, not in any specific column. I am not
> searching for a specifig IP address I am just searching for any IP
> address. How would I find the IP on the line?? 

Again, just finding, not validating:

        /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/

Depending on the format of your logfile, you may want to further 
anchor the pattern by whitespace or an other separator.

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to