Regex to extract info from a string
<p>I have recently started making an ircbot, and in my ban command I have a need to extract the name of the target and the mode.</p>

<p>There are to different modes + and -</p>

<p>So one example of a string would look like</p>

<pre><code>!!ban + Sjele
</code></pre>

<p>or</p>

<pre><code>!!ban - Sjele
</code></pre>

<p>How would I find and get the mode, either - or + with a regex and the target in this case Sjele?</p>

<p>I tried this to in the online regextester regexpal and it did not work, this is as close as I could get with my low knowledge of regex's</p>

<pre><code>((.*)(+| -)(.*))
</code></pre>

<p>Using matcher and pattern when this regex is working, I would like 3 variables:</p>

<ul>
<li>pref (should be !!ban)</li>
<li>mode (either - or +)</li>
<li>target (in this case Sjele)</li>
</ul>

<p>Thanks<br/>
(English is not my first language and I do have troubles getting understood, if I were unclear please tell me and I'll try to explain better.)</p>
