jQuery extract numbers from string

Sam Deering
Share

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

function getId(str)
{
    return str.replace(/[^d.,]+/,'');
}