This is an example of code that uses regular expressions to limit a field's entry. Put this in a field's Input Validation formula:
@If( @Matches(Serial_Num; "+{0-9}"); @Success; @Matches(Serial_Num; "+{a-zA-Z}"); @Success; @Do(@Prompt([OK]; "Invalid Serial Number"; "The Unit Serial Number contains an illegal character, probably a carriage return. Please remove the illegal character and save again."); @Return("")) )