I needed to be able to specify constraints on text boxes specifically but simply so I wrote jquery.constrain.js. This lets you specify patterns (regexs) , limit characters to a certain quantity,or just prohibit characters on text boxes . Also includes an numeric extension so you can pass number formats in string form.
Project page is here: http://plugins.jquery.com/project/constrain mike