Ayesha Fathima

Ayesha Fathima

  • 1.7k
  • 169
  • 14.2k

strip base 64 value from string

Mar 31 2020 6:29 AM
Hi there,
 
I am having big string something like email content,from that content i need to take only base 64 value.
Like we will be pasting some images in tinymce and  while retreiving that content value will get base 64 and some other content also.
 
Someone can help me on this. 
 
Example:
 
  1. var stringval="<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB" /><br /><br /><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABVYAAAMAC" /><br /><br />From: "   
  2.   
  3.   
  4. from the above string i need output as iVBORw0KGgoAAAANSUhEUgAAB,iVBORw0KGgoAAAANSUhEUgAABVYAAAMAC  
I tried some code from my side...but it is giving only first base64 value,but i need how many images are there those many base64 values..
 
Some help will be greatly appreciated. 

Brought to you by:

Answers (3)