Just to offer another solution that’s not broadcasting:
test.s2 = map (test.s1) do s
m = match(r"[0-9]*",s)
m.match
end
I offer this because, as neat as broadcasting is, I find I’m easily tripped up when things get complicated, or I’m using a container that shouldn’t be broadcasted into (eg in.(xs, some_set)
will try to broadcast through the set as well, when I usually want to check if each element of xs
is in the set).