title: Matching with Regex in Javascript (Optional substring)
body: <p><strong>String:</strong></p>
  
  <pre><code>&lt;p&gt;[element title="Some title"]Some random text[/element]
  [element]Some random text[/element]&lt;/p&gt;
  </code></pre>
  
  <p><strong>Need to extract:</strong></p>
  
  <p>1) Element title (optional) - 'Some title'</p>
  
  <p>2) Element content - 'Some Random Text'</p>
  
  <p><a href="http://regex101.com/r/eB0jE6/1" rel="nofollow">http://regex101.com/r/eB0jE6/1</a></p>
  
  <p><strong>How to make title in the element optional?</strong></p>