Regex to avoid specific special characters

Need a regular expression that should avoid a specific string or all string which are having below mentioned symbols

Special character to avoid:

  1. Colon (:)
  2. Double forward slash (//)
  3. Dot (.)
  4. Question Mark (?)
  5. Ampersand (&)
  6. Equal To (=)
  7. Single forward slash (/)


  • Only symbols used in the URL pattern should be validated/avoided.
  • Other than that all other symbols are accepted
  • Regex should be working in javascript specifically

Comments (1)

Pankaj Patel's photo

Would you mind adding example cases?