views:

169

answers:

1

Hi all,

I have this string

<p><img src="http://www.foo.com/bar.jpg"&gt;&lt;/p&gt;&lt;p&gt;other content here</p>

I need to extract the src url . The img tag appears only at the beggining of the string.

Thanks in advance.

A: 

You can use String.split:

var s:String = "<p><img src=\"http://www.foo.com/bar.jpg\"&gt;&lt;/p&gt;&lt;p&gt;other content here</p>";
var a:Array = s.split('"');

The src url would be the 2nd element of the array, so:

trace(a[1]);
danii
Thnx danii you rock!
chchrist
thanx :) glad to help
danii