title: R Regex: Parenthesis Not Acting as Metacharacter
body: <p>I am trying to split a string by the group "%in%" and the character "@".  All documentation and everything I can find says that parenthesis are metacharacters used for grouping in R regex.  So the code</p>
  
  <pre><code>    &gt; strsplit('example%in%aa(bbb)aa@cdef', '[(%in%)@]', perl=TRUE)
  </code></pre>
  
  <p>SHOULD give me</p>
  
  <pre><code>    [[1]]
      [1] "example" "aa(bbb)aa"      "cdef"
  </code></pre>
  
  <p>That is, it should leave the parentheses in "aa(bbb)aa" alone, because the parentheses in the matching expression are not escaped.  But instead it ACTUALLY gives me</p>
  
  <pre><code>    [[1]]
      [1] "example" ""   ""    ""    "aa"    "bbb"   "aa"    "cdef"
  </code></pre>
  
  <p>as if the parentheses were not metacharacters!  What is up with this and how can I fix it? Thanks!</p>
  
  <p>This is true with and without the argument perl=TRUE in strsplit.</p>