I am trying to replace numbers in string with the character "X" which works pretty good by replacing every individual number.
This the code:
let htmlStr = initialString.replace(/[0-9]/g, "X");
So in a case scenario that initialString = "p3d8" the output would be "pXdX"
The aim is to replace a sequence of numbers with a single "X" and not every number (in the sequence) individually. For example:
If initialString = "p348" , with the above code, the output would be "pXXX". How can I make it "pX" - set an "X" for the whole numbers sequence.
Is that doable through regex?
Any help would be welcome
+after[0-9].