title: What exactly does a Regex created with Regex.fromLiteral() match?
body: <p>I've created a very simple match-all Regex with <code>Regex.fromLiteral(".*")</code>. </p>
  
  <p>According to the <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-regex/from-literal.html#kotlin.text.Regex.Companion$fromLiteral(kotlin.String)/literal" rel="noreferrer">documentation</a>: "Returns a literal regex for the specified literal string."</p>
  
  <p>But I don't really get what "for the specified literal string" is supposed to mean.</p>
  
  <p>Consider this example:</p>
  
  <pre><code>fun main(args: Array&lt;String&gt;) {
      val regex1 = ".*".toRegex()
      val regex2 = Regex.fromLiteral(".*")
      println("regex1 matches abc: " + regex1.matches("abc"))
      println("regex2 matches abc: " + regex2.matches("abc"))
      println("regex2 matches .* : " + regex2.matches(".*"))  
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>regex1 matches abc: true
  regex2 matches abc: false
  regex2 matches .* : true
  </code></pre>
  
  <p>so apparently (and contrary to my expectations), <code>Regex.fromLiteral()</code> and <code>String.toRegex()</code> behave completely different (I've tried dozens of different arguments to <code>regex2.matches()</code> - the only one that returned true was <code>.*</code>)</p>
  
  <p>Does this mean that a Regex created with <code>Regex.fromLiteral()</code> always matches only the <em>exact string</em> it was created with? </p>
  
  <p>If yes, what are possible use cases for such a Regex? (I can't think of any scenario where that would be useful)</p>