Regex for Checking for at Least One Special Character

Tests whether a string contains at least one non-alphanumeric character.

Published October 11, 2026

Tests whether a string contains at least one non-alphanumeric character.

Key points

  • The exact set of "special characters" required varies by application — adjust the character class to match your own policy

Example

.*[!@#$%^&*(),.?":{}|<>].*
More General articles