Hi, people!
I need to find all numbers and multiply them by ten in
document.getElementById(‘numbers’).innerHTML
I know that it can be done by php with
$text = preg_replace("|\\d+|e", "\\\\0*10", $text)
But how it can be done by javascript?
Hi, people!
I need to find all numbers and multiply them by ten in
document.getElementById(‘numbers’).innerHTML
I know that it can be done by php with
$text = preg_replace("|\\d+|e", "\\\\0*10", $text)
But how it can be done by javascript?
Yes, thanks, it is quite useful.
But i just know how to replace with fixed string
str.replace(/\d+/g, “12345”)
But is it possible in JavaScript to replace it with function? Something like
str.replace(/\d+/g, \0*10) ?
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?