Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strip out portion of a url using jquery

Tags:

jquery

url

strip

Google produces image thumbs like so http://images.google.com/images?q=tbn:9vPPg9Y5ojFMeM::www.maniacworld.com/amazing-cars.jpg

I only need the main image url which in this case is www.maniacworld.com/amazing-cars.jpg I noticed we have :: before the main image url

What is the easiest way to do this via jquery.

like image 619
Hussein Avatar asked Dec 07 '25 13:12

Hussein


1 Answers

You don't need jquery, you can probably just use a regular expression.

var re= /.+::/
var newurl = googleurl.replace(re,'');

Here's a working demo: http://jsfiddle.net/Rsefq/

like image 64
Keltex Avatar answered Dec 09 '25 01:12

Keltex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!