using DataFrames
using DataFramesMeta
# This is the data
df = DataFrame(A = 1:5, B = ["Th32is","i35s","124my","test775","var23ia5ble"])
# This is what the output should be
@transform!(df, :B = match.(r"\d+", :B))
@transform(df, :B = [x.match for x in :B])
# But I would like to do it in one transform call
# I tried to just use getproperty
df = DataFrame(A = 1:5, B = ["Th32is","i35s","124my","test775","var23ia5ble"])
@transform(df, :B = match.(r"\d+", :B).match)
# trying to broadcast explicitly
df = DataFrame(A = 1:5, B = ["Th32is","i35s","124my","test775","var23ia5ble"])
@transform(df, :B = getproperty.(match.(r"\d+", :B), :match))
# but neither of these work
Is there a (not too convoluted way) to do this in one transform call?
As for your problem with getproperty, in @transform, which accepts full columns, check out the docs here about βWorking with Symbol s without referring to columnsβ. You need to escape the Symbol with ^.