JSFiddle - React, Tailwind, and code Playground

by saidulu401

JavaScript

function matchExact(str) {
   var match = str.match(/^na|[0-9]*$/);
   return match != null && str == match[0];
}
alert(matchExact("na"));
alert(matchExact("154"));