Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
How can I allow only alphanumeric including Chinese, Japanese and all that cryptographic languages?

I'm currently trying to filter out any bad char from a string to only allow alphanumeric ones but I need to include Chinese, Japanese and all that non-Latin languages as well. After some hours of reading RegEx, I'm more confused than informed. Currently I have:

let string = 'Test=๐Ÿ˜•ๆŸฅ็œ‹         ' +
    '';

string = string.replace(/[^A-Za-z\d\p{Han}]+$/ug,' ');

console.log(string);

Without the {Han} everything works well, but no Chinese chars. Any idea? I want to keep it simple, but this seems to be impossible.

about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

I suggest removing all chars other than letters and digits:

let string = 'Test=๐Ÿ˜•ๆŸฅ็œ‹         ';
string = string.replace(/[^\p{L}\p{N}]+/ug,' ').trim();
console.log(string);

If you need to allow diacritics add \p{M} there:

string.replace(/[^\p{L}\p{N}\p{M}]+/ug,' ').trim();
about 4 years ago ยท Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!