---
title: "Special character remove from url or any string"  
description: "Special character remove from url or any string"  
author: "Rajesh Goswami"  
published: 2010-12-06  
updated: 2010-12-06  
canonical: https://www.mindstick.com/forum/119/special-character-remove-from-url-or-any-string  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Special character remove from url or any string

how we [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) the [special character](https://www.mindstick.com/forum/12719/how-to-make-response-write-display-special-character-like-lt-gt) from any [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) \
for example\
string sSpecailChar="rajesh have $280.00 Rs. only, What!?"\
in this [sample](https://www.mindstick.com/news/2174/mars-mission-by-nasa-prepares-for-tests) how remove the special character like $!.? \
is the best solution of this [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic)![Special character remove from url or any string](https://www.mindstick.com/app_images/htmleditor.icons/eusa_wall.gif)\

## Replies

### Reply by Amit Singh

we use regex class which contain many important properties like relace(), split(), match() etc\
we remove the special char from any string \
for example:\
firstly, we use System.Text.RegularExpressions namespce\
\
string strData = "rajesh have $280.00 Rs. only, What!?";\
string pattern = "[^a-zA-Z0-9]+";\
Regex rgx = new Regex(pattern);\
Response.Write("<font color='green'>Before Replace: </font> " + strData+"<br/>");\
Response.Write("<font color='green'>After Repalce: </font>" + rgx.Replace(strData, " "));\
\
output:\
Untitled PageBefore Replace: rajesh have $280.00 Rs. only, What!?\
After Repalce: rajesh have 280 00 Rs only What \


---

Original Source: https://www.mindstick.com/forum/119/special-character-remove-from-url-or-any-string

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
