Use .source property of js/RegExp instead of ugly hack