Regex get text between parentheses and keywords <p>i have a text pattern like this;</p> <pre><code>(((a) or (b) or (c)) and ((d) or (e)) and ((!f) or (!g))) </code></pre> <p>and i want to get it like this;</p> <pre><code>((a) or (b) or (c)) ((d) or (e)) ((!f) or (!g)) </code></pre> <p>After that i want to seperate them like this;</p> <pre><code>a,b,c d,e !f,!g </code></pre> <p>any help would be awesome :)</p> <p><strong>edit 1:</strong> sorry about the missing parts; using language is C# and this is what i got;</p> <pre><code>(\([^\(\)]+\))|([^\(\)]+) </code></pre> <p>with i got;</p> <pre><code>(a) or (b) or (c) and (d) or (e) and (!f) or (!g) </code></pre> <p>thanks already!</p>