JavaScript
Article
By Sam Deering

jQuery extract numbers from string

By Sam Deering

Quick jQuery code snippet to extract numbers from string using a replace regex method.

function getId(str)
{
    return str.replace(/[^d.,]+/,'');
}
Recommended
Sponsors
Get the latest in JavaScript, once a week, for free.