character validation

Hi there, I need to take a string and validate it to ensure that it has no dirty characters ( spaces, $ etc) and then display an error if a dirty character is in the string, can you help me with some sample code please?
[226 byte] By [bmthboya] at [2007-9-25]