title: PHP regex: what is "class at offset 0"?
body: <p>I'm trying to strip all punctuation out of a string using a simple regular expression and the php preg_replace function, although I get the following error:  </p>
  
  <blockquote>
    <p>Compilation failed: POSIX named classes are supported only within a class at offset 0  </p>
  </blockquote>
  
  <p>I guess this means I can't use POSIX named classes outside of a class at offset 0. My question is, what does it means when it says "within a class at offset 0 "?  </p>
  
  <pre><code>$string = "I like: perl";    
  
  if (eregi('[[:punct:]]', $string))  
      $new = preg_replace('[[:punct:]]', ' ', $string); echo $new;
  </code></pre>