Re: regex and ip address extraction

2002-09-20 Thread Dharmender Rai
try out (\d+\.){3}(\d+) but it won't take CIDR addresses and will not check the validity of the addresses. --- Griggs Rob <[EMAIL PROTECTED]> wrote: > Hi Guys, > > The code below extracts an ip address from the > /var/log/maillog file in the > event of the line containing the words "rej

Re: regex and ip address extraction

2002-09-19 Thread John W. Krahn
Griggs Rob wrote: > > Hi Guys, Hello, > The code below extracts an ip address from the /var/log/maillog file in the > event of the line containing the words "reject=550". It works fine, but is > there a way of shortening that regular expression? You can save six characters by removing the '$_

RE: regex and ip address extraction

2002-09-19 Thread Griggs Rob
[EMAIL PROTECTED]] > Sent: 19 September 2002 18:36 > To: [EMAIL PROTECTED] > Subject: Re: regex and ip address extraction > > > Griggs Rob wrote: > > > Hi Guys, > > > > The code below extracts an ip address from the > /var/log/maillog file in > > the e

Re: regex and ip address extraction

2002-09-19 Thread david
Griggs Rob wrote: > Hi Guys, > > The code below extracts an ip address from the /var/log/maillog file in > the event of the line containing the words "reject=550". It works fine, > but is there a way of shortening that regular expression? > > open(LOG,"/var/log/maillog"); > > while() {

RE: regex and ip address extraction

2002-09-19 Thread nkuipers
/\[(\d+\.\d+\.\d+\.\d+)\]/ hmmm...maybe this? /\[((?:\d+\.){3}\d+)\]/ #non-capturing parens group for {3}, nested in $1 parens -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]