I need to find all numbers and multiply them by ten indocument.getElementById('numbers').innerHTML
I know that it can be done by php with
$text = preg_replace("|\\d+|e", "\\\\0*10", $text)
Yes, thanks, it is quite useful.But i just know how to replace with fixed stringstr.replace(/\d+/g, "12345")
that is very close!
But what is wrong with
str = "123";
document.write (str.replace(/(\\d+)/, "$1"*1))
Here, $1 just cannot be converted to number. It prints NaN.Though if it is "$1"+1, it prints 1231 (as normal string).
Is it possible to convert $1 to number?