To run cellfun
the input obviously has to be a cell
. The problem is that if data
is a char
array rather than a cell
array of char
arrays, regexp
will not return a cell, at least not when called with the 'once'
option. The easiest solution is simply to ensure that the input to the first regexp
call is a cell array, if only one with a single cell.
Anyway, right before the first regexp
, add:
if ischar(data),
data = cellstr(data);
end
Also note that the second regexp
should escape the dot (.
):
IPs = regexp(domain_URL,'(?<=//)(?<=//)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})','match','once');
And out of curiosity, why the repeated look-behind ((?<=//)
)?