正则表达式PHP正则表达式!A到[^ A]

Hi fellow programmers.

So i am trying to make covertion to PHP regex and I got stuck on converting !A to [^A]

    $string = "!A!Bb%!C!";
    $string =  preg_replace("/(?<=(?<!%)!.)/", "]" , $string ); 
    $string =  preg_replace("/(?<!%)!(?=.)/", "[^" , $string);

which works fine but when string is with two !! next to each other its not working for example like this "!A!!Bb%!C!" and the % is nullying the negation.

try here http://www.phpliveregex.com/

use /.(?<=!)(\w)/g and replace with [^\1]

which when takes an input string as !A!Bb%!C!

will output

[^A][^B]b%[^C]!

demo here : http://regex101.com/r/tX2gR1