I want to substitute all 4 instances of the number 300 from the code below (which my website users will be pasting whenever they create a new blog post), with 470.
<div>
<object width="300" height="300">
<embed src="link-removed" width="300" height="300"></embed>
</object>
<p>
<a href="another-link">link</a>
</p>
</div>
The width and height of the code being pasted might not always be 300 by 300.
So I figure I probably need a regular expression that subs any numeric value that follows the strings "width=" and "height=", whilst remembering to account for the quotations marks that surround the number. Can anyone tell me if that's the best way, and if so, what would be the best regex?
In case it matters, the code being pasted is stored as "text" in the db rather than as a string, as it's quite lengthy (i've removed a few hundred chars from what you see pasted here)...