This works
var str = '- **(450.00/450.00000000) x 100**'
str = str.replace(/[\*]{2}([^\*]+)[\*]{2}/g, '<B>$1</B>');
console.log(str);
but this does not work
var str = '- **(450.00/450.00000000) * 100**'
str = str.replace(/[\*]{2}([^\*]+)[\*]{2}/g, '<B>$1</B>');
console.log(str);
because /[\*]{2}([^\*]+)[\*]{2}/g stops at the first asterisk (* 100) and then determines it is not a match because there is only one asterisk, not two.
How can I get the regex to ignore the * 100 and match ** at the end of the line?
>Solution :
IF the possible alternatives to be matched are just the 2 options in your question, this: /[\*]{2}(.*)[\*]{2}/ should do the work.