In Scala - I need to validate if a given string is non-empty. Following snippet returns true. What is the issue with the regex along with match?
  def isEmpty(input: String): String = {
    val nonEmptyStringPattern = raw"""(\w+)""".r
    input match {
      case nonEmptyStringPattern => s"matched $input"
      case _ => "n/a"
    }
  }
However, the same regex works are expected on matches method as below.
   def isEmpty(input: String): String = {
    val nonEmptyStringPattern = raw"""(\w+)""".r
    input match {
      case input if nonEmptyStringPattern matches( input) => s"matched $input"
      case _ => "n/a" ```.  
    }
  }
Does this mean match cannot have regex instances ?