There is a component to use regular expressions which you can use to validate inputs. Download the EnterpriseManager component and publish it in your server. There you'll find an extension named Text that contains an action named RegExp_Search which you can use to validate inputs.
Check the attached oml for an example. You will need to publish the EntepriseManager solution first.