Parsing values from string into struct using match in Julia
The easiest thing I can think of is to use eachmatch -- when there is no match at all, it returns an empty iterator:
julia&gt; collect(eachmatch(r&quot;(bar:(\w*))&quot;, &quot;bla bar:werfsd 1223 bar:skdf&quot;))
2-element Array{RegexMatch,1}:
 RegexMatch(&quot;bar:werfsd&quot;, 1=&quot;bar:werfsd&quot;, 2=&quot;werfsd&quot;)
 RegexMatch(&quot;bar:skdf&quot;, 1=&quot;bar:skdf&quot;, 2=&quot;skdf&quot;)

julia&gt; collect(eachmatch(r&quot;(bar:(\w*))&quot;, &quot;bla &quot;))
RegexMatch[]

Then you can simply combine those into a dictionary, for example:
julia&gt; Dict(re =&gt; [m[1] for m in eachmatch(re, s)] for re in patterns)
Dict{Regex,Array{T,1} where T} with 3 entries:
  r&quot;qux:(\w*)&quot; =&gt; Union{Nothing, SubString{String}}[]
  r&quot;baz:(\d*)&quot; =&gt; SubString{String}[&quot;33&quot;]
  r&quot;bar:(\w*)&quot; =&gt; SubString{String}[&quot;werfsd&quot;, &quot;skdf&quot;]

Without further information about how you want to organize your data structure when more then one value occurs, I can't really say more.  Perhaps you can make use of merge.
Give types to struct fields, and don't use mutable structs unless necessary.  Without knowing more, I suggest
struct Foo
    bar::Union{String, Nothing}
    baz::Union{String, Nothing}
    qux::Union{String, Nothing}
end
function Foo(;bar=nothing, baz=nothing, qux=nothing) 
    return Foo(convert(Union{String, Nothing}, bar),
               convert(Union{String, Nothing}, baz),
               convert(Union{String, Nothing}, qux))
end

which also takes care of converting the SubString from the regex match, in case this is relevant.