I have the following:
html = html.replace(/[\d\.]+/g, "");
I want to the get the value of /[\d\.]+/g and put it in between the "" and then add some over jibberish after it.
Is this possible? If so how? Whats the term called of passing a value from parameter 1 to 2?
You want to reference a match from the first parameter? Fairly simple.
First, a “match” is defined inside parenthesis. This way we say “this is the first group.” So, you want to match the entire string, so let’s put everything between the start and end slash in parenthesis:
Now, we reference these past matches with $# where #, starting at 1, is the order in which they appear. So, our final replacement looks like this:
Where, as you can see, you can define your extra content.