Split the string using Regex with the special characters
<p>I have a string as <strong>[@variable] -eq 'some value'</strong> or <strong>'some value' -eq [@variable]</strong> and i want to split it using Regex.</p>

<p>The expected output is as below</p>

<ol>
<li>[@variable]</li>
<li>-eq</li>
<li>'some value'</li>
</ol>

<p>or </p>

<ol>
<li>'some value'</li>
<li>-eq</li>
<li>[@variable]</li>
</ol>

<p>I have the used regular expression <strong>\w+|'[\w\s]*'</strong> to match and split the string but it gives me below output</p>

<ol>
<li>variable</li>
<li>eq</li>
<li>some value</li>
</ol>

<p>which ignores the special characters with the string.</p>

<p>Can anyone please help me on this?</p>

<p><strong>EDIT</strong></p>

<p>The answer by <strong>lbrahim</strong> is working for most of the scenario but failing when the value is date time.</p>

<p><strong>[@variable] -eq 'MM/dd/yyyy'</strong></p>

<p>The above expression should also work for the same</p>