Regex for setting <img> src replaced with specific name
I have image tags in 开发者_运维问答the form of
<img src="cid:imgName@01CAB53F.69BAB010"/>
here 01CAB53F.69BAB010 will change dynamically...I want to ignore things whatever comes after the imgName.
i want to replace it with
<img src="imgName"/>
if and only if the image take comes in the specified format..
I searched here , couldnt get the exact thing i need. I am new to regex.
I am using OpenPop to get mails. when reading mails, images are rendered in the specified format. so i have to store the image and replace it with the storedname.
can anyone please help me?
this regex will match all img tag followed by a src attribute
(<img src=")[^"]+("/>)
and replace it by the value imgName ($1 and $2 stands for left and right part of img tag) :
$imgName$2
do not forget to add the flag g (global)
s/<img src="cid:(\w+)@[0-9A-F]+\.[0-9A-F]+\"\/>/<img src="$1"\/>/i
精彩评论