In my react application I have to show an error if an user name already exists.
const regex = '(?:' + availableNames.join('|') + ')';
<div className="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input className="mdl-textfield__input" pattern={regex} autoFocus/>
<label className="mdl-textfield__label" htmlFor="inp-1">User name</label>
<span className="mdl-textfield__error" >Name already exists</span>
</div>
I have started with the following expression (?:alex|max|sam)
and I know that this allows the user only to input alex, max or sam.
But I can't manage to negate the expression. I would be grateful for any help