P
Ponto André
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:
<p><a href='http://sub-domain.domain.net/path/folder/figurename1010.jpg'
target=_blank><img style='float:left;margin:8px' border=0
src='http://sub-domain.domain.net/path/folder/thum/figurename1010-thumb.jpg'></a>
some text</p>
rubular outputs me this:
Match captures:
Result 1
1. http://sub-domain.domain.net/path/folder/figurename1010.jpg
Result 2
1.
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?
/(https??:/*\w*\.*-*)*(?:\.gif|\.jpg|\.bmp|\.png|\.jpeg))/i
i've tested it on rubular.
and for this example text:
<p><a href='http://sub-domain.domain.net/path/folder/figurename1010.jpg'
target=_blank><img style='float:left;margin:8px' border=0
src='http://sub-domain.domain.net/path/folder/thum/figurename1010-thumb.jpg'></a>
some text</p>
rubular outputs me this:
Match captures:
Result 1
1. http://sub-domain.domain.net/path/folder/figurename1010.jpg
Result 2
1.
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?