
Jean
User

Mar 4, 2001, 12:09 AM
Post #4 of 5
(7439 views)
|
The regex that I've used in the example looks for the IP in the beginning of a line contained in $ipnum (not in the $line that contains the lines read from the file). I've left this because you said the code posted was just a part of larger program and it didn't show the contents of the $ipnum... You could use the following examples in order to change the behaviour of the example from my previous post: 1. $ipnum =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/ Looks for an IP in all the $ipnum, not just in the beginning; 2. $line =~ /^\s*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/ Looks for an IP in the beginning if the $line that is, in the beginning of each line of the file being read; 3. $line =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/ Looks for an IP in all the $line that is, IP will be found if it's contained ANYWHERE in the file; Jean Spector QA Engineer @ Extent Technologies, Ltd. mage@lycosmail.com
|