REGEX: Replace all characters A-Z and a-z in a variable.

This is a regex expression you can use to filter a variable (let’s say a number), from all unwanted chars and sybols. Below is an example of how to use it with the Regex.Replace method:

[A-Za-z;'%^!@#$%&*()_+-]
result = Regex.Replace(value,"[A-Za-z;'%^!@#$%&*()_+-]", String.Empty)
Advertisement
This entry was posted in Uncategorized. Bookmark the permalink.

One Response to REGEX: Replace all characters A-Z and a-z in a variable.

  1. Soul says:

    The question is,… “How to apply this code on my wp theme”?

    I wanna replace “#” on my post title. Can use it? If so,… how to apply this code on wp theme?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s