title: JavaScript regex get all numbers but exclude all between brackets
body: <p>I have string:</p>
  
  <p><code>123 df456 555 [ 789   ] [abc 1011 def ] [ ghi 1213] [jkl mno 1415 pqr] 161718 jkl 1920</code></p>
  
  <p>I need to get only numbers, that don't placed between <code>square brackets [ ]</code>.
  All the resulted numbers I need to place inside <code>square brackets [ ]</code>
  The correct result should be:</p>
  
  <p><code>[123] df456 [555] [ 789   ] [abc 1011 def ] [ ghi 1213] [jkl mno 1415 pqr] [161718] jkl [1920]</code></p>
  
  <p>I've tried to write such JavaScript regex:
  <code>/(?!\[(.*?)\])((\s|^)(\d+?)(\s|$))/ig</code></p>
  
  <p>but it seems to be wrong, it seems like positive lookahead has more priority than negative lookahead.</p>