ponto
1
ok, i’ve written this regex:
/(https?:(?\w.-)*(?:.gif|.jpg|.bmp|.png|.jpeg))/i
i’ve tested it on rubular.
and for this example text:
some text
rubular outputs me this:
Match captures:
Result 1
-
http://sub-domain.domain.net/path/folder/figurename1010.jpg
Result 2
-
http://sub-domain.domain.net/path/folder/thum/figurename1010-thumb.jpg
but in my code:
matchdata =
text.match(/(https?:(?[a-zA-Z].-\d*)*(?:.gif|.jpg|.bmp|.png|.jpeg))/i).captures
puts matchdata.size
size prints me “1”.
am i capturing wrong?
ponto
2
but in my code:
matchdata =
text.match(/(https?:(?[a-zA-Z].-\d*)*(?:.gif|.jpg|.bmp|.png|.jpeg))/i).captures
puts matchdata.size
size prints me “1”.
am i capturing wrong?
use text.scan() which matches all occurences
p
text.scan(/(https?:(?\w.-)*(?:.gif|.jpg|.bmp|.png|.jpeg))/im)
=> [[“http://sub-domain.domain.net/path/folder/figurename1010.jpg”],
[“http://sub-domain.domain.net/path/folder/thum/figurename1010-thumb.jpg”]]
ponto
3
Hi All,
Get all images from given URL
Desktop Application from jazzez
Kindly go through below link and download the EXE file.
Install in Windows machine and enjoy with impressed images