G
Guest
Hello, I have an file that I am reading and it has some goffy characters in
it and I want to use a regular expression to clean up those characters. I am
not sure how to construct a regular expression which find these characters
and replace them with spaces. I am guessing that a regular expression which
would find the "good" values would look something like this..
Regex expr = new Regex (@"\w()\.,!@#$%<>" - but I am looking for anything
which is the oposite of that, as if I find something which is not in this
list, I want to replace it with spaces. (i.e expr.Replace("MyText|", " ");
)
I was thinking of using the following, but how to I tell it all the other
characters it should exclude from the match? Is there a "NOT" instruction?
Regex regexpr = new Regex (@"\W");
Hopefully this make sense...
Thanks in advance for your assistance!!!
it and I want to use a regular expression to clean up those characters. I am
not sure how to construct a regular expression which find these characters
and replace them with spaces. I am guessing that a regular expression which
would find the "good" values would look something like this..
Regex expr = new Regex (@"\w()\.,!@#$%<>" - but I am looking for anything
which is the oposite of that, as if I find something which is not in this
list, I want to replace it with spaces. (i.e expr.Replace("MyText|", " ");
)
I was thinking of using the following, but how to I tell it all the other
characters it should exclude from the match? Is there a "NOT" instruction?
Regex regexpr = new Regex (@"\W");
Hopefully this make sense...
Thanks in advance for your assistance!!!