 
   """
   def run(regex, string, options // [])
-  def run({ Regex, compiled, _, _, groups }, string, options) do
+
+  def run(regex(re_pattern: compiled, groups: groups), string, options) do
     return = Keyword.get(options, :return, return_for(string))
 
     captures =
       case Keyword.get(options, :capture, :all) do
-        :groups -> groups || raise "Regex was not compiled with g"
+        :groups -> groups || raise "regex was not compiled with g"
         others  -> others
       end
 

      Regex.captures %r/c(?<foo>d)/g, "abcd"  #=> [{:foo, ["d"]}]

  """
  def captures({ Regex, _, _, _, groups } = regex, string, options // []) do
    unless captures = Keyword.get(options, :capture) do
      captures = if groups do
        List.sort(groups)


  """
  def scan(regex, string, options // [])

  def scan(regex(re_pattern: compiled), string, options) do
    return = options[:return] || return_for(string)
    options = [{ :capture, :all, return }, :global]
    case :re.run(string, compiled, options) do
