Replace the structure and then judge & lt; objectclassid = & quot; clsid: d27cdb6e-ae6d-11cf-96b8-444553540000 & quot; width = & quot; 550 & quot; height = & quot; 400 & quot; codebase = & quot; http: // replace structure with fpdown before determining
Changed:
The values of width and height are changed. if width is less than 805, the values of width and height do not need to be changed.
If width> 805
Then height = height * 805/width;
Width = 805
How can I write this regular expression? I recently used many regular expressions. how can I learn regular expressions well?
------ Solution --------------------
Describe your rules
../Documents/medies/ESIL_xiaoshengqi1.gif
This is a new one.
Image: ESIL_xiaoshengqi1.gif?
Width = "550" height = "400" what about this ??? Which one does it need?
------ Solution --------------------
Refer:
PHP code
$ S = <
Html; $ r = preg_replace ('#. +
] *>. + # S ', '', $ s); preg_match (' # width =" (\ d +) "\ s * height =" (\ d +) "# I ', $ r, $ m); if ($ m [1]> 805) {$ h = ($ m [2] * 805) /$ m [1]; $ r = preg_replace ('/(width =) "(\ d +)" (\ s * height =) "(\ d +) "/S', '$1" $2 "$3 "'. $ h. '"', $ r);} echo $ r;
------ Solution --------------------
PHP code
$s =<<< TXT TXT;$r= preg_replace_callback('#.+
]*>.+#s', 'back', $s);function back($r) { if($r[3] > 805) { $r[4] = round($r[4]*805/$r[3]); $r[3] = 805; } return <<< TXTTXT;}echo $r;