title: How can I get the value from a string that has the values inside a square bracket []?
body: <p>I have a string that comes to me like this: "[value1][value2]"</p>
  
  <p>How can I get the values that are inside the square brackets?
  NOTE: if the string is like this "[][value2]" the first bracket that has a space must return a "" to me...</p>
  
  <p>I have been trying a lot of regex and split but none workd.</p>
  
  <p>this is the last I tried: </p>
  
  <pre><code>var pattern = /[([^]]*)]/g; 
  var res = pattern.exec(datos[0].title); 
  </code></pre>
  
  <p>Another one I tried is: </p>
  
  <pre><code>var res = datos[0].title.match(/^.*?[([^]]*)].*?[([^]]*)]/gm);
  </code></pre>
  
  <p>but none do what I need... </p>
  
  <p>I'm trying to find a way "that does it all" a regex that gets anything inside the Square brackets (even white spaces)</p>