2
I would like to make an array containing strings in this format:
[Texto com acento espaço e números 99]
Example, if I have this string:
var texto = "Eu quero comprar [qtdOvos] e [qtdFrutas] somando o total de [totalCompras]";
I need to mount the following array:
var arrayStrings = ["[qtdOvos]", "[qtdFrutas]", "[totalCompras]";
Is there any way to do this through regular expression?
And if I need a word with an accent?
– Joao Paulo
@Joaopaulo everything that is inside
[]
You want to "catch" right? In that case you can have/(\[.*?\])/g
– Sergio