Scala split camel case source code example

I'm sorry, I don't remember where I found this code, but here's a Scala function to split a camel case string into its components strings (substrings):

  def splitCamelCase(s: String): String = {
   return s.replaceAll(
      String.format("%s|%s|%s",
         "(?<=[A-Z])(?=[A-Z][a-z])",
         "(?<=[^A-Z])(?=[A-Z])",
         "(?<=[A-Za-z])(?=[^A-Za-z])"
      ),
      " "
   ).replaceAll("  ", " ")
  }

I'll write more about this in a future tutorial, but for now I just wanted to share this code.