I have a string that comes to me like this: "[value1][value2]"
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...
I have been trying a lot of regex and split but none workd.
this is the last I tried:
var pattern = /[([^]]*)]/g;
var res = pattern.exec(datos[0].title);
Another one I tried is:
var res = datos[0].title.match(/^.*?[([^]]*)].*?[([^]]*)]/gm);
but none do what I need...
I'm trying to find a way "that does it all" a regex that gets anything inside the Square brackets (even white spaces)