how to allow empty String using regex in java?
<p>Basically i have an email box where it only should contain characters are allowed in email boxes but can be empty, the problem is that when the box is empty then it pops my error which i have created saying</p>

<blockquote>
  <p>Email box contain character that are not allowed</p>
</blockquote>

<pre><code>String UcharSet = "[a-zA-Z0-9-~!_#(@).]+";
boolean UMORN = UserName.matches(UcharSet);
if(!UMORN)
    PopMyError();
</code></pre>

<p>as long as i know i don't have the null character in my allowed list, so can you tell me how to allow the box can be empty too?</p>

<p>and do tell have i got all characters that are allowed in Emails.</p>