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:
Hope this helps, -gjb-