If you want to remove test
if it occurs at the start of the line and is followed by a word character then you could use a non-word-boundary:
^test\B
See it working online: rubular
If you want to remove test
if it occurs at the start of the line and is followed by any character (except a new line) then you could use a lookahead:
^test(?=.)
See it working online: rubular