i have a following text in a file:
host1
menu=gateway
title=gateway
host=192.168.0.1
host2
menu=xgateway
title=xgateway
host=192.168.0.2
host3
menu=ygateway
title=ygateway
host=192.168.0.3
I have to match the 3 lines folowing by "host2" .
these lines need to be matched.
host2
menu=xgateway
title=xgateway
host=192.168.0.2
I used this codes.But its not complete. Can anyone give the Regular expression to do this multiline pattern match?
while(!feof($file))
{
$k= fgets($file);
if ( (preg_match("/^host2", $k)) )
{
echo "found";
}
}