Regexp Javascript , is it possible to concatenate ?
Ex 1: (Working Example)
var reg = new RegExp(/(\d+): ([A-Za-z0-9çÇáéíóúãõÁÉÍÓÚÃÕ]+): ([A-Za-z0-9çÇáéíóúãõÁÉÍÓÚÃÕ]+)/);
var arr = all_titles.split(reg);
I'm trying to do it but I can't figure it out how to concatenate, cause I actually want to concatenate a variable in it, but if I add the Quotes it just doesn't work.
Ex 2:
var reg = new RegExp("/(\d+): ([A-Za-z0-9çÇáéíóúãõÁÉÍÓÚÃÕ]+): ([A-Za-z0-9çÇáéíóúãõÁÉÍÓÚÃÕ]+)/");
var arr = all_titles.split(reg);
The Example 2 doesn't work for some reason (without even any concatenation of variable), then I stripped the delimiters and still didn't work.
What I want to do is get something like this -> 20: lalalalala: whateverIsWritten
var variable = "lalalalala";
var reg = new RegExp("/(\d+): "+variable+": ([A-Za-z0-9çÇáéíóúãõÁÉÍÓÚÃÕ]+)/");
var arr = all_titles.split(reg);
Thanks in advance!