I am being fed a url that looks like this:
http://hamilton.kijiji.ca/c-buy-and-sell-sports-bikes-Kids-bike-W0QQAdIdZ215282410
I want to pull out the numbers after adIdZ
How can I pull these numbers off dynamically?
I am being fed a url that looks like this:
http://hamilton.kijiji.ca/c-buy-and-sell-sports-bikes-Kids-bike-W0QQAdIdZ215282410
I want to pull out the numbers after adIdZ
How can I pull these numbers off dynamically?
s= 'http://hamilton.kijiji.ca/c-buy-and-sell-sports-bikes-Kids-bike-W0QQAdIdZ215282410'
s = s.replace( /\d+$/, '' )
Updated
s = 'http://hamilton.kijiji.ca/c-buy-and-sell-sports-bikes-Kids-bike-W0QQAdIdZ215282410'
s = s.match( /(\d+)$/ )
if ( s.length )
alert( s[1] )
It's not entirely clear what you want to achieve. If you wish to strip, that is remove, the final id, meder gave the correct reply. If you wish to extract the id, it's a simple change from his code:
s= 'http://hamilton.kijiji.ca/c-buy-and-sell-sports-bikes-Kids-bike-W0QQAdIdZ215282410'
id = s.match(/\d+$/)