val pattern = "gr[ea]y".toRegex() The[ea]class allows to use either 'e' or 'a' character in the pattern. Kotlin named character classes There are some predefined character classes. The\smatches a whitespace character[\t\n\t\f\v], the\da digit[0-9], and the\wa word character[a...
Short summary: theRegex.replacefunction with the functionaltransformparameter will no longer be inline in Kotlin/JS Deprecation cycle: 1.6.0: remove theinlinemodifier from the affected function Different behavior of theRegex.replacefunction in JVM and JS when replacement string contains group reference ...
Libraries: extensions for `java.util.Optional` in stdlib, min/max(By/With) functions for non-empty collections, stable `Regex.matchAt()`, `Regex.matchesAt()`, `findAnnotations()`, `DeepRecursiveFunction` functions, getting named groups of a regex match in JS and Native Gradle: Experimental...
Libraries: extensions for `java.util.Optional` in stdlib, min/max(By/With) functions for non-empty collections, stable `Regex.matchAt()`, `Regex.matchesAt()`, `findAnnotations()`, `DeepRecursiveFunction` functions, getting named groups of a regex match in JS and Native Gradle: Experimental...
Named Group 正则表达中可以使用小括号()表示分组。在 Java 7 以后支持了命名分组,即可以通过指定的分组名来获得匹配结果,而无需使用分组的索引来获得。分组的基本语法为(?<组名>其它操作)。 // 指定了第一个分组名为 year,第二个为 monthMatcherdateMatcher=Pattern.compile("(?<year>\\d{4})-(?<month>...
{ LogManager.getLogger(getClassName(lambda.javaClass)) } private fun <T : Any> getClassName(clazz: Class<T>): String = clazz.name.replace(Regex("""\$.*$"""), "") val topLog by logger { } class TopLevelLoggingTest { val classLog by logger { } @Test fun `What is the java...
toRegex() val input = "Coordinates: Austin, TX: 123" val match = regex.find(input)!! println(match.groups["city"]?.value) // "Austin" — by name println(match.groups[2]?.value) // "TX" — by number }Named backreferencingYou can now also use group names when backreferencing ...
KT-12753 Provide an access to named group matches of Regex match result (for JDK 8 only). Add assertFails overload with message to kotlin-test. IDE New features "Leaking this" inspection This inspection reports dangerous operations inside constructors including: Accessing non-final property in co...
("CompileClasspath") && it.isCanBeResolved } val regex = Regex(pattern = "^(spring-cloud-starter|spring-boot-starter|micronaut-core|kotlin-stdlib-[0-9]|foundation-desktop).*$") val jarsToReport = mppCompileConfiguration.filter { it.name.matches(regex) }.files if (jarsToReport.isNot...
clean//group by the flight origin renamed into "from".groupBy { origin named"from"}.aggregate {//we are in the context of a single data group//total number of flights from origincount() into"count"//list of flight numbersflightNumber into"flight numbers"//counts of flights per airlineair...