title: match a String based on regex pattern matching scala
body: <p>I wrote the following regex : </p>
  
  <pre><code>val reg = ".+([A-Z_].+).(\\d{4})_(\\d{2})_(\\d{2})_(\\d{2})\\.orc".r 
  </code></pre>
  
  <p>which is supposed to parse  the following strings :
  "S3//bucket//TS11_YREDED.2018_09_28_02.orc"
  the parse method is :</p>
  
  <pre><code>val dataExtraction: String =&gt; Map[String, String] = {
    string: String =&gt; {
      string match {
        case reg(filename, year, month, day) =&gt;
                   Map(FILE_NAME-&gt; filename, YEAR -&gt; year, MONTH -&gt; month, DAY -&gt; day)
        case _  =&gt; Map(FILE_NAME-&gt; filename,YEAR -&gt; "", MONTH -&gt; "", DAY -&gt; "")
      }
    }
  }
  val YEAR = "YEAR"
  val MONTH = "MONTH"
  val DAY = "DAY"
  val FILE_NAME = "FILE_NAME"
  </code></pre>
  
  <p>but it doesn't work properly 
  it is supposed to ommit the bucket name and parse filename and date </p>
  
  <p>so the expected output shall rather be : Map(FILE_NAME-> TS11_YREDED, YEAR -> , MONTH -> 09, DAY -> 28)
  Any idea how to fix it please ?</p>