H
Henry
I have this simple code,
string escaped = Regex.Escape( @"`~!@#$%^&*()_=+[]{}\|;:',<.>/?" + "\"" );
string input = @"a&+[b`${c}a'?sd:r]" + "\"" + @"@(-d)\e";
Regex re = new Regex( string.Format(@"([{0}]+)", escaped),
RegexOptions.CultureInvariant );
string s = re.Replace( input, "" );
It doesn't seem to work, regular expression return without filter out any
character
However if I remove or change the position of "]" to be the first character,
it works.
string escaped = Regex.Escape( @"]`~!@#$%^&*()_=+[{}\|;:',<.>/?" + "\"" );
I totally do not understand how this regular expression escaping works. What
am I doing wrong here?
Thanks
Henry
string escaped = Regex.Escape( @"`~!@#$%^&*()_=+[]{}\|;:',<.>/?" + "\"" );
string input = @"a&+[b`${c}a'?sd:r]" + "\"" + @"@(-d)\e";
Regex re = new Regex( string.Format(@"([{0}]+)", escaped),
RegexOptions.CultureInvariant );
string s = re.Replace( input, "" );
It doesn't seem to work, regular expression return without filter out any
character
However if I remove or change the position of "]" to be the first character,
it works.
string escaped = Regex.Escape( @"]`~!@#$%^&*()_=+[{}\|;:',<.>/?" + "\"" );
I totally do not understand how this regular expression escaping works. What
am I doing wrong here?
Thanks
Henry