You can use regex to go about this:
on !@*:rawmode:#: { if ($regex($1,/([+][^\-]*b)/)) { mode # $replace($regml(1),$chr(43),$chr(45)) $2 } }
This is just an example.