# is equivalent to $chan, so $regsubex(#,^#*,) is just $regsubex($chan,^#*,), so you would replace $chan in the code with that.
That said, the $regsubex might be incorrect, depending on how you want it to be...
For example, if the channel name is ##channel, that $regsubex will remove both '#'. Note that the channel name in this case is "#channel". If you want to simply remove the first '#' in this case you can simply use $mid($chan,2)