Reputation: 317
we have data coming from another application(DB) like below image file has been stored like
@1="< img width=498 height=425 src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ...">"
var data = @1 DownloadCode();i want to download file image file. I am newbie in JS.
Upvotes: 1
Views: 574
Reputation: 319
Here how you should do it
var str = '<img width=498 height=425 src="data:image/jpeg;base64,/9j/4AAQSkZJRgA...">';
var regex = /<img.*?src="(.*?)"/;
var src = regex.exec(str)[1];
console.log(src);
Upvotes: 1