title: How to add switch case for like operator in scala?
body: <p>I have a data frame with column (A, B) where column B is free test which I am converting to type (NOT_FOUND, TOO_LOW_PURCHASE_COUNT and etc) to aggregate better. I created a switch case of all possible patter and their respective type but it is not working.</p>
  
  <pre><code>def getType(x: String): String = x match {
      case "Item % not found %" =&gt;"NOT_FOUND"
      case "%purchase count % is too low %" =&gt;"TOO_LOW_PURCHASE_COUNT"
      case _ =&gt; "Unknown"
  }
  
  getType("Item 75gb not found") 
  
  val newdf = df.withColumn("updatedType",getType(col("raw_type"))) 
  </code></pre>
  
  <p>This gives me "Unknown". Can some one tell me how to do switch case for like operator ?</p>