<p>I'm looking for a regex that can pull out quoted sections in a string, both single and double quotes.</p>

<p>IE:</p>

<pre><code>"This is 'an example', \"of an input string\""
</code></pre>

<p>Matches:</p>

<ul>
<li>an example</li>
<li>of an input string</li>
</ul>

<p>I wrote up this:</p>

<pre><code> [\"|'][A-Za-z0-9\\W]+[\"|']
</code></pre>

<p>It works but does anyone see any flaws with it?</p>

<p>EDIT: The main issue I see is that it can't handle nested quotes.</p>

It works but doesn't match other characters in quotes (e.g., non-alphanumeric, like binary or foreign language chars). How about this:
```
```
[\"']([^\"']*)[\"']
```
```
My C# regex is a little rusty so go easy on me if that's not exactly right :)