c# - Regular Expression Matching and Replacing -



c# - Regular Expression Matching and Replacing -

i have next regular look allows string contain alphabets, space, ,, - , :

^[a-za-z ,\‘-]*$

link demo

but want replace other character other mentioned in regex space. intending c# using regex.replace() not working.

any suggestions helpful.

negate them!

[^a-za-z ,\‘-]

and replace space.

^ negates character class.

code:

var str = regex.replace("this ) content", @"[^a-za-z ,\‘-]", " "); demo

c# regex

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -