Here's a vi that tests whether user pressed a letter or number. You can build on this, keeping track of what position the S/N string is in (string length). When you get the correct type, concatenate it into the rest of the string, otherwise throw it out.
Hope it helps.
Tim