Problem with Javascript RegExp-mask
- by OrjanL
I have a string that looks something like this:
{theField} > YEAR (today, -3) || {theField} < YEAR (today, +3)
I want it to be replaced into:
{theField} > " + YEAR (today, -3) + " || {theField} < " + YEAR (today, +3) + "
I have tried this:
String.replace(/(.*)(YEAR|MONTH|WEEK|DAY+)(.*[)]+)/g, "$1 \" + $2 $3 + \"")
But that gives me:
{theField} > YEAR (today, +3) || {theField} > " + YEAR (today, +3) + "
Does anyone have any ideas?