I\'ve created a very simple match-all Regex with Regex.fromLiteral(\".*\").
According to the documentation: \"Returns a literal regex for the specified
The Regex.fromLiteral() instantiates a regex object while escaping the special regex metacharacters. The pattern you get is actually \.\*, and since you used matches() that requires a full string match, you can only match a .* string with it (with find() you could match it anywhere inside a string).
See the source code:
public fun fromLiteral(literal: String): Regex = Regex(escape(literal))