I found this code can be useful for my Java assignment. Good thing is we can use the third party code now (properly cited!).
However it's missed a few features. So I've added those and sent the diff (available by request) to the author:
New features are:
1. regexp validation
2. rule can be optional - validate only if not empty