0

Hello I have created a Regex to remove invalid characters in a string:

Here it is:

Regex replace_invalid_caracters = new Regex(@"[\\|/|*|+|-|%|=|^|@|#|$|!|~|`|?|<|>|:|(|)|{|}|;|,|_|]");

The thing is that then I use it in a method to remove this invalid characters.

It manages to remove all invalid characters except for "-". I would like to know how to tell the regex expression to remove "[" or "]" and also "|" and of course "-".

What can I do?

Thanks in advance.

Edited by MrCapuchino: n/a

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by MrCapuchino
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.