A cybersecurity analyst has a character vector of IP addresses and needs to extract only those matching IPv4 format (e.g., '192.168.1.1'). Which base R function uses a regex for this?
-
A
grep('^(\\d{1,3}\\.){3}\\d{1,3}$', ips, value=TRUE)
-
B
strsplit(ips, '.', fixed=TRUE)
-
C
substr(ips, 1, 15)
-
D
nchar(ips) == 15