Try:
(?<!#)(?>(##)*)#[^#]+
or
(?<!#)(##)*#[^#]+
You can add whatever other criteria are necessary to find the end of the match.
BTW, the reason you don't match "#param1" is that your lookbehind requires at least 1 match of the '(##)' sub-pattern. However if you change the '+' to '*' on its own, then you can get incorrect matches such as "####param1" which will simply ignore the first # and match the next 3.
Susan