Regex get number (id) in a string(url) with different format

Hi,
What’s the best way to do this:


var re = /(\\d+)/,
urls = [
    'http://www.emp-online.it/bin/shop.php?prog=shop&funktion=PRODUCTINFO&article=670017',
    'http://www.emp-online.it/art_670017/'
],len = urls.length;
for(var i = 0; i < len; i++){
    var match = re.exec(urls[i]);
    if(match[1]!==null){
        console.log(match[1]);
    }
}

Bye

How about by using .match() instead?