title: Regex: Unclosed character class near index
body: <p>I am not very familiar with Regex and I have some issue with a regex string in Java. I get the following error:</p>
  
  <pre><code>Unclosed character class near index 198
  </code></pre>
  
  <hr>
  
  <pre><code>"(?=^[\\x00-\\x7F]+$)^(([^&lt;&gt;()|[\\]\\\\.,;:\\s@\\\"\"]+(\\.[^&lt;&gt;()[\\]\\\\.,;:\\s@\\\"\"]+)*)|(\\\"\".+\\\"\"))@((\\[(2([0-4]\\d|5[0-5])|1?\\d{1,2})(\\.(2([0-4]\\d|5[0-5])|1?\\d{1,2})){3} \\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$"
  </code></pre>
  
  <p>Could anyone enlighten me on this issue?</p>
  
  <p>Original received pattern from web team is this (and it's a valid regex if we check it <a href="https://regex101.com/" rel="nofollow">here</a>):</p>
  
  <pre><code>(?=^[\x00-\x7F]+$)^(([^&lt;&gt;()|[\]\\.,;:\s@\""]+(\.[^&lt;&gt;()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@((\[(2([0-4]\d|5[0-5])|1?\d{1,2})(\.(2([0-4]\d|5[0-5])|1?\d{1,2})){3} \])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$
  </code></pre>
  
  <p>Thanks</p>