The code is as follows |
Copy Code |
//ig |
This regular and matching link tag is basically the same, modified as follows, Tag name IMG, no end tag but > end.
The test code is as follows:
The code is as follows |
Copy Code |
<script type= "Text/javascript" > function Replacereg (REG,STR) { Return Str.replace (Reg, ' [img]$1[/img] ') } var reg = //ig; var str = ' I am the legendary picture of the Hey. '; document.write (Replacereg (reg,str) + ' <br/> '); </script> |
The second is replacing the flash code embedded with the object code with [swf]url[/swf].
The positive text is as follows:
The code is as follows |
Copy Code |
/<object[ss]*?src= ([ss]+?) (? =s) [ss]*</object>/i |
If all of the attributes have double quotes, they also need to be modified.
The test is as follows:
The code is as follows |
Copy Code |
< Script type= "Text/javascript" > function replacereg (reg,str) { return str.replace (Reg, ' [swf]$1 [/swf] ') } var reg =/<object[ss]*?src= ([ss]+?) (? =s) [ss]*</object>/i; var str = ' <object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 codebase=http:// download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=5,0,0,0 width=255 height=250>< param name=movie Value=url><param name=quality value=high><embed src=url quality=high Pluginspage =http://www.macromedia.com/shockwave/download/index.cgi? P1_prod_version=shockwaveflash type=application/x-shockwave-flash width=255 height=250></embed> </object> '; document.write (Replacereg (reg,str) + ' <br/> '); </script> |