1

I am new to Regex and I want to create some validation that checks for special characters.

Example:

 const regexSpecialCharacters = /[^a-zA-Z.,-/'()\s]/;

          if (regexSpecialCharacters.test(values)) {
            true
          }

I have this as a base /[^a-zA-Z.,-/'()\s]/ which returns true when there are special characters such as "!" and "?". It also returns true for numbers. It also returns true for accented letters, e.g. è ë however I don't want it to return true for accented letters.

How can I modify the regex to allow accented letters?

Wiktor Stribiżew
  • 561,645
  • 34
  • 376
  • 476
Ellie Keen
  • 11
  • 1
  • Possibly not the cleanest solution but have used this until I can find a better solution: /[!@#$%^&*()_+\=\[\]{};:"\\|,.<>\/?0-9]+/ – Ellie Keen Jun 24 '20 at 12:42

0 Answers0