I have a variable that can store several values (words, letters, numbers, etc.), depending on an insert in an input type field. I would like to do a search that lists only 1-digit numbers (/ \ b \ d {1} \ b /), and any other information present in the "false" field as a result. Ex:
var test = "1";
console.log(test.match(/\b\d{1}\b/)); // corresponde e portanto é 'true'
var test = "sp 1 inf"; // mesmo assim corresponde com "test.match(/\b\d{1}\b/)"
What I want is a modification in "test.match (/ \ b \ d {1} \ b /)" which gives "false" as a result in the second case (var test="1 info"), , not matching. Thanks in advance for your attention.