Skip to content
Advertisement

How to replace occurance of numbers with single value?

I have below code

JavaScript

Which gives output:

JavaScript

I need:

JavaScript

So from string if numbers found just replace with %d one only, not every digit.

Advertisement

Answer

You need to change your regex to "[0-9]+"

JavaScript

Oracle’s doc: Quantifiers

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement