JSFiddle - React, Tailwind, and code Playground

JavaScript

var regex = /[^A-Za-z\-\']/, string = 'test';
if(!string.match(regex)) {
    alert('Compliation success!');
}