str = "1*/+-2"
patt = '[+\\-]+([+\\-])|[/*]+([/*])'; // [+\\-]+([+\\-]) [/*]+([/*])
reg = new RegExp(patt,'g')
while (str.match(reg)!=null)
{
str = str.replace(reg,"$1");
}
To by melo nahradit opakujici znamenka.
Vysledek ted 1-2
Vysledek ocekavany 1/-2
Firefox 58. Co delam spatne s tim reg. vyrazem? A pritom samostatne kazda cast toho reg. vyrazu funguje spravne.
patt = '[+\\-]+([+\\-])'
patt = '[/*]+([/*])'