There is a regular expression of the form

/([а-яA-Z0-9])/ig 

I need to invert it so that it searches for all characters except data.


This is not how it works:

 /(?![а-яA-Z0-9])/ig 

UPD: In the end result
There is an arbitrary string, it is necessary to check if there are not letters and numbers in the string.

  • ^ inside [] how negation works - Grundy
  • @Grundy, this does not solve the problem. - Ivan
  • Without examples it is not entirely clear what is required. - Wiktor Stribiżew
  • There is an arbitrary string. It is necessary to check whether there are not letters or numbers in it. - Ivan
  • 2
    var result = /[^а-яёA-Z0-9]/i.test(s) - Wiktor Stribiżew

1 answer 1

 function test() { var str = document.getElementById("text").value; var res = /[^а-яA-Z0-9]/i.test(str); if (res) console.log("Есть"); else console.log("Нет"); } 
 <input id="text" type="text" /> <button id="btn" onclick="test()">Test</button>