JSFiddle - React, Tailwind, and code Playground

by 20yco

JavaScript

var name = 'qwertysdf';
var mobile = '93874678';

if(name.match(/[a-zA-Z]+/g)){
 console.log('match');
} else{
 console.log('no match');
}

if(mobile.match(/^[0-9]*$/)){
 console.log('match');
}else{
 console.log('no match');
}