JSFiddle - React, Tailwind, and code Playground
HTML
<!-- Should pass -->
<p>Phil D'Sousa</p>
<p>Billy - the - Kid</p>
<!-- Should Fail -->
<p>Joe</p>
<p>454545 354434</p>
CSS
p {display:none;}
JavaScript
$(function() {
$("p").each(function() {
var string = $(this).html();
$("body").append('"' + string + '" - ');
var matches = string.match(/\b[^\d\s]+\b/g);
if (matches && matches.length >= 2)
$("body").append("passes.<br/>");
else
$("body").append("fails.<br/>");
});
})