san
san

Reputation: 1859

Regular expression to validate a string

What should be the regular expression if i need to show the error if the string contains character other than letters, digits, blank, underscore (_), dash (-), dollar sign ($), at sign (@),open curly brace ({), close curly brace (}) and pound sign (#)

Regex.IsMatch(myString, ?????????, RegexOptions.IgnoreCase)

Thanks..

Upvotes: 0

Views: 54

Answers (1)

John
John

Reputation: 348

You can use this expression :

^[a-zA-Z0-9\ _#\-\$\{\}@]*$

PS : Usefull tool to create REGEX : https://www.debuggex.com/

Upvotes: 1

Related Questions