   @doc """
   Returns the underlying re_pattern in the regular expression.
   """
-  def re_pattern({ Regex, compiled, _, _, _ }) do
+  def re_pattern(regex(re_pattern: compiled)) do
     compiled
   end
 

      Regex.index %r/e/, "abcd"     #=> nil

  """
  def index({ Regex, compiled, _, _, _ }, string) do
    case :re.run(string, compiled, [{ :capture, :first, :index }]) do
      :nomatch -> nil
      { :match, [{index,_}] } -> index

      Regex.replace(%r/(b)/, "abc", "[\\1]") #=> "a[b]c"

  """
  def replace(regex(re_pattern: compiled), string, replacement, options // []) do
    opts   = if options[:global] != false, do: [:global], else: []
    return = options[:return] || return_for(string)
    opts   = [{ :return, return }|opts]
