Both # and $ can be escaped by doubling: ## or $$ respectively.
I though I had a problem with a double #, but in fact it was because I missed a double $ at the same time!
I though I had a problem with a double #, but in fact it was because I missed a double $ at the same time!