I've tried to extract only IP addresses from the the given example input, but it extracts some text with it. Here's my code:
$spfreccord="v=spf1 include:amazonses.com include:nl2go.com include:smtproutes.com include:smtpout.com ip4:46.163.100.196 ip4:46.163.100.194 ip4:85.13.135.76 ~all";
$regexIpAddress = '/ip[4|6]:([\.\/0-9a-z\:]*)/';
preg_match($regexIpAddress, $spfreccord, $ip_match);
var_dump($ip_match);
I'm looking to match only the IPv4 IP address xxx.xxx.xxx.xxx
in each column of the table, but it looks like that the $regexIpAddress
is not correct.
Can you please help me find the correct regex to extract only the IPv4 IP addresses? Thanks.