var string = "yo|||sup"; if( string.match(/(.+?)\|\|\|(.+)/) ) { alert(true); } else { alert(false); }