serialize/deserialize for Regex

Currently Regex objects cannot be sent across processes. This PR fixes the same.