I have the following string:
<div height="40px" width="30px" />
I would like to replace with regex all the numbers that have px after them with X times their values. (X is a variable).
So if X=3, the result will be
<div height="120px" width="90px" />
Please note that X must be a variable that I will retrieve to the function
The following code will replace
30pxwith240pxin the Stringsusing regular expressions:Here are the steps it performs:
sfor matches and for each match:var.pxagain and pass it as a replacement string.