Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript match image attribute value

var str = "<img alt='' src='http://api.com/images/UID' /><br/>Some plain text<br/><a href='http://www.google.com'>http://www.google.com</a>";

var regex = /<img.*?src='(.*?)'/;
var src = regex.exec(str)[1];

console.log(src);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #match #image #attribute
ADD COMMENT
Topic
Name
9+2 =