in reply to Regexp and HTML revisited...
in thread Regexps to change HTML tags/attributes

To escape '#', just use '\#', that should do.

Two further remarks:

  1. Since you're using the /i modifier, [0-9a-f] will do.
  2. I don't think you want ';;;;' to match, so I'd replace the ';*' by ';?'.

Hope this helps, -gjb-