regex no special characters code example

Example 1: regular expression should not contain special character

//Author: Mohammad Arman Khan
//Regular Expression should not contain Special Characters
var regex = /^[A-Za-z0-9 ]+$/;

Example 2: regex replace all special characters

Regex.Replace(your String, @"[^0-9a-zA-Z]+", "")

Example 3: regex match numbers and special characters

echo %H1E2L+L#O! | sed 's/[^A-Z!]//g'	#replaces number and special
characters which aren't ! or an uppercase letter A-Z

Tags:

Misc Example