title: preg_match "Compilation failed: missing )"
body: <p>its probably a stupid fault but I have a regex what should match on</p>
  
  <ul>
  <li>allalaa</li>
  <li>afkdsf[]</li>
  <li>afadf43fds["guyish"]</li>
  </ul>
  
  <p>but not on strings starting with a number</p>
  
  <p>here is the code</p>
  
  <pre><code>preg_match('~^[A-Za-z][A-Za-z0-9]*(\[(?P&lt;array&gt;"(?:.*(?:(?&lt;!\\)(?&gt;\\\\)*\").*|.*)+(?:(?&lt;!\\)(?&gt;\\\\)*"))\]|\[\]|)$~',trim($item[0],"    \r"),$matches)
  </code></pre>
  
  <p>but when I execute it I get the error <code>Compilation failed: missing ) at offset 95</code></p>
  
  <p>while when I execute it <a href="http://l2y.eu/dddd4" rel="nofollow">here</a> it works fine?</p>
  
  <p>whats wrong with the code?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>readable regex:</p>
  
  <pre><code>~
     ^
     [A-Za-z]
     [A-Za-z0-9]*
     (
        \[
        (?P&lt;array&gt;
        "
        (?:
            .*
            (?:
               (?&lt;!\\)
               (?&gt;\\\\)*
               \"
             )
             .*
          |
             .*
          )+
          (?:
             (?&lt;!\\)
             (?&gt;\\\\)*
             "
           )
         )
         \]
       |
       \[\]
       |
     )$
  ~x
  </code></pre>