1126 Reads
You can use the following JavaScript function to detect if a text contains a telephone number.

function hasPhoneNumber(text){
return text.match(/\d/g) != null && text.match(/\d/g).length >= 10 && text.match(/\d/g).length < 15;
}