GLP GLP - 1 year ago 107
ASP.NET (C#) Question

What is the regular expression for "No quotes in a string"?

I am trying to write a regular expression that doesn't allow single or double quotes in a string (could be single line or multiline string). Based on my last question, I wrote like this

, but it is not working. Really appreciate if anybody could help me out here.

Answer Source

Just use a character class that excludes quotes:


(Within the [] character class specifier, the ^ prefix inverts the specification, so [^'"] means any character that isn't a ' or ".)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download