JSFiddle - React, Tailwind, and code Playground

by henser

JavaScript

const regex = /^[\dA-Za-z-]+$/;
const secretValue = /^[\dA-Za-z-]+$/;

if (!regex.test(secretValue.key)) {
  console.log('Invalid key format.');
}