Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- embeddedString = embeddedString.replace(/(widths*=s*["'])[0-9]+(["'])/ig, $1 + yourWidth + $2);
- embeddedString = embeddedString.replace(/(heights*=s*["'])[0-9]+(["'])/ig, $1 + yourHeight + $2);
- embeddedString = embeddedString.replace(/widths*=s*["']["']/ig, function($0, $1)
- {
- return $1 * 2;
- });
- var originalWidth;
- var originalHeight;
- embeddedString = embeddedString.replace(/(?:width|height)s*=s*["']([0-9]+)["']s*(?:width|height)s*=s*["']([0-9]+)["']/ig, function($0, $1, $2, $3, $4)
- {
- // $0 = original string
- // $1 = either 'width' or 'height'
- // $2 = the value of width or height, depending on above
- // $3 = either 'width' or 'height'
- // $4 = the value of width or height, depending on above
- // here you might want to set another value, eg:
- originalWidth = $2;
- return "";
- });
- width="(.*?)" height="(.*?)"
- $pattern = '/width="(.*?)" height="(.*?)"/';
- $subject = 'width="500" height="300"';
- preg_match($pattern, $subject, $matches);
- print_r($matches);
Add Comment
Please, Sign In to add comment