Another is a looping approach where you deconstruct the nested brackets one level at a time, else it's hard(TM) to ensure your single regexp will work as expected.
Here's an example in ruby:
str = "a[a=d b&c[e[100&2=34]]] e[cheese=blue and white] x[a=a b]"
left = str.dup
tokn=0
toks=[]
# Deconstruct
loop do
left.sub!(/\[[^\]\[]*\]/,"\{#{tokn}\}")
break if $~.nil?
toks[tokn]=$&
tokn+=1
end
left=left.split(/\s+/)
# Reconstruct
(toks.size-1).downto(0) do |tokn|
left.each { |str| str.sub!("\{#{tokn}\}", toks[tokn]) }
end
The above uses {n} where n is an integer during the deconstruction, so in some cases original input like this in the string would break the reconstruction. This should illustrate the approach though.
Writing code that does the split by iterating through the characters is simpler and safer though.
Example in ruby:
str = "a[a=d b&c[e[100&2=34]]] e[cheese=blue and white] x[a=a b]"
toks=[]
level=st=en=0;
str.each_byte do |c|
en+=1;
level+=1 if c=='['[0];
level-=1 if c==']'[0];
if level==0 && c==' '[0]
toks.push(str[st,en-1-st]);
st=en
end
end
toks.push(str[st,en-st]) if st!=en
p toks