From this url i need to extract only the picture name using regular
Expressions.
That is I Want to Extract like this => Davis-Love-III.jpg.
Any Advices
From this url i need to extract only the picture name using regular
Expressions.
That is I Want to Extract like this => Davis-Love-III.jpg.
Any Advices
What do you want to do with
aggbug.ashx?id=56f9e33a-6333-4daf-b4e1-137ddc051adf ? Are you using it ?
If not , for the rest of the pictures , you could be calling
File.basename on them and get the last part only . For example , on http://www.ingolfwetrust.com/golf-central/content/binary/Davis-Love-III.jpg
you will receive Davis-Love-III.jpg .
What do you want to do with
aggbug.ashx?id=56f9e33a-6333-4daf-b4e1-137ddc051adf ? Are you using it ?
If not , for the rest of the pictures , you could be calling
File.basename on them and get the last part only . For example , on http://www.ingolfwetrust.com/golf-central/content/binary/Davis-Love-III.jpg
you will receive Davis-Love-III.jpg .
sorry yar ..Nothing Work On That.I get nil value
Any ways i used this expression to extract the imgage url =>
(/<img.*?>/)
It has given me image url.
But I want to get all the url's based on file extensions like jpg and
png..
That Is... if it contains image file extension,Only those image urls
has to fetched
ext = %w( .jpg .png .gif ... )
Hpricot(DATA.read).search("img") do |img|
name = File.basename(img.attributes['src'])
puts name if ext.include?(File.extname(name))
end
ext = %w( .jpg .png .gif ... )
Hpricot(DATA.read).search("img") do |img|
name = File.basename(img.attributes['src'])
puts name if ext.include?(File.extname(name))
end
Another way to extract the URL and get only the path:
require 'uri'
tag = '<img src="ingolfwetrust.com;
File.basename(URI.split(URI.extract(b)[0])[5])
=> "aggbug.ashx"
Then you can check with File.extname to check for the extensions you
want, as others have shown.
Hope this gives you other ideas,
Jesus.
···
On Mon, Aug 25, 2008 at 2:13 PM, Newb Newb <hema@angleritech.com> wrote:
What do you want to do with
aggbug.ashx?id=56f9e33a-6333-4daf-b4e1-137ddc051adf ? Are you using it ?
If not , for the rest of the pictures , you could be calling
File.basename on them and get the last part only . For example , on http://www.ingolfwetrust.com/golf-central/content/binary/Davis-Love-III.jpg
you will receive Davis-Love-III.jpg .
sorry yar ..Nothing Work On That.I get nil value
Any ways i used this expression to extract the imgage url =>
(/<img.*?>/)
It has given me image url.
But I want to get all the url's based on file extensions like jpg and
png..
That Is... if it contains image file extension,Only those image urls
has to fetched