g1smd - 4:21 pm on Dec 15, 2012 (gmt 0)
That's the right pattern but could be ambiguous when test1#test2#test3#test4 is input.
Would you want test2 or test3 to match? It would usually match test2.
I rarely specify a pattern without a start anchor and a grouping to get me along to the right place to start looking for real. That would be another [^#]+ again.