Regular expression for quoted text and special characters

saleem

New Member
I'm trying to figure out a regular expression in .NET that can detect the XML special characters that are enclosed in quotation marks. They can contain other characters as well but at least one ocurrence of the following has to exist \[code\]< > & ' "\[/code\]Matches \[code\]"Hello &""& Something""Testing <>"\[/code\]Does not match \[code\]"foo bar"\[/code\]I've tried expressions like \[code\]"[&<>\"\'\w\s]+"\[/code\] but this regex does accepts strings where the special characters are absent. The purpose of this expression is to cleanse all XML Attributes from special characters that might crash parsers.
 
Back
Top