🤯 New: Coding Assessments Practice your skills on real-world programming challenges

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.,]+/,'');
}