Add support for validation functions.

I realize this is probably out of scope for an html5 validation plugin. But I needed support for a bit more advanced validation on a couple of fields and didn't want to use a separate plugin just for that.

I've also added a couple of utility functions to get patterns for usage by other scripts.

There is a slight change to the validation functionality as well. All three of required, patterns and function are tested if available, not just one.

If any of these changes are of interest, I can add som unit tests as well.