tim,
The leading and trailing slashes are the delimiters, you can think of them as a container for the actual expression. For the purpose of breaking down the expression these can be ignored.
So, :\) this is the actual smiley you are looking for, the slash is there as the ) character has special meaning with regex so we are required to escape it.
Next we have (?!\)) the outer bracket set is the container for the assertion. And that leaves us with ?!\) in PCRE the combination of ?! basically means 'not followed by'. So in this case ?!\) means not followed by the ) character, again, we escape the ) character as this also has special meaning within the epression.
tim wrote:
how come this dont work:
$code[] = "[ |]

[ |]";
dont that mean a space OR no space before and after within the [] brakets?
No, the square bracket defines a character class, you would need to define a sub-pattern for the space or not part, the ? character is used to denote 'zero or one' so in your case the expression should be..
$code[] = " ?:\)";
However, that would mean you will also be replacing the space (if it exists), so you would need to define the space as a sub-pattern and your replacement would be requied to use the 'backreference' to also add the space if it were there.
So it would look like this...
$code[] = "( ?):\)";
$replace[] = '\\1[edited]';