Answer the question
In order to leave comments, you need to log in
How to select everything except letters and numbers and umlaut in js with a regex?
There is a line, for example in Turkish (same story with Finnish, German, etc.)
Here: Türk and Türk
I need to remove all characters that are not a letter or a number. I understand that ü is a unicode character and I need to add the /u flag so that it is recognized as a letter and not as a special character. symbol.
I am writing a regular expression:
And indeed, everything works: spaces fall under the condition, and will be replaced by emptiness (i.e. removed), and the umlaut / will remain untouched:
But if the same trick is performed in the browser console, then the umlaut character is deleted along with spaces. Why?'Türk and Türk'.replace(/\W/gu, '');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question