parsing - PHP extract and parse _ basic question -


i have files (about 500 files) no extension.
managed view contents , has weird tags , stuff.

i need extract ip addreesses it.. ex in line 2 there ip address ... (71.129.195.163)

also, there html tags < href = "http://www.xyz.com" > in lot of lines. need domain name , xyz.com.

could assist php newbie? know entire file string , tht.. since php powerful, looking sweet , simple way achieve .

thanks lot

regular expressions great this.

to find ips in file:

$ippattern = '/(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}/';  $ips = array(); preg_match_all($ippattern, $filecontents, $ips); $ips = $ips[0]; 

to find links:

$linkpattern = '/href(\s+)?\=(\s+)?[\'"](.+?)[\'"]/';  $links = array(); preg_match($linkpattern, $filecontents, $links);  $link = $links[3]; 

the file content assumed in $filecontents. run code every file. if need collect ips , domains can merge them big arrays:

$allips = array(); $alllinks = array();  // after each run of above code do: $allips = array_merge($allips, $ips); $alllinks[] = $link; 

Comments