In Java/Scala, `Pattern.compile` fails immediately on invalid regex. In ScalaJS, it isn't until the pattern is used that it fails. ``` scala // Doesn't throw in ScalaJS val p = Pattern.compile("*") ``` To mimic JVM behaviour here (because I need to validate user-entered regex immediately), I just do this as a workaround: ``` scala // Throws an exception p.matcher("").matches() ```