Added check for global flag in pattern.

If you had /g in your `pattern` option, the results of `pattern.regex.test(key)` [here](https://github.com/hapijs/joi/blob/master/lib/object.js#L168) will toggle back and forth between `true` and `false` creating very unpredictable validation results. 

I'm not sure what to do about the versioning of this. If you're using a `pattern` function with "/g" then this is going to break your code.