If you just want to store the regular nick, you can use a regsubex that just tokenize the regular nick :
raw *:353:tokenize 32 $regsubex($4-,/((@|%|\+).\S+)/g,) | write nicks.txt $*
Or use $prefix

raw 366:*:if $me ison $2 { filter -wlfcxg $2 nicks.txt /[ $prefix ]/ }
on *:text:!regnick*:#channel:.play # nicks.txt | .remove nicks.txt