Convert string to regex when explicitly required

When data is sent in `JSON`, strings must be used for regex.
This converts these to `regex`es automatically when a `regex` is explicitly required (i.e. using `$regex`), in stead of writing an external wrapper that loops the JSON looking for regexes.