User: joe Date: 08 Apr 26 13:58 Revision: 8c08dd8bacb8bcce0dc811db7a757eb60300045f Summary: Merge branch '2025.3' into 2026.1 TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10508&personal=false Index: gradle.properties =================================================================== --- gradle.properties (revision 0d81efc7df8750dffed0e1169a4d2da034945996) +++ gradle.properties (revision 8c08dd8bacb8bcce0dc811db7a757eb60300045f) @@ -23,7 +23,7 @@ ideaVersionName = 2026.1 -coreVersion = 1.8.13 +coreVersion = 1.8.14 # Silences a build-time warning because we are bundling our own kotlin library kotlin.stdlib.default.dependency = false Index: src/main/kotlin/util/utils.kt =================================================================== --- src/main/kotlin/util/utils.kt (revision 0d81efc7df8750dffed0e1169a4d2da034945996) +++ src/main/kotlin/util/utils.kt (revision 8c08dd8bacb8bcce0dc811db7a757eb60300045f) @@ -48,8 +48,10 @@ import java.lang.invoke.MethodHandles import java.util.Locale import java.util.concurrent.CancellationException +import java.util.regex.PatternSyntaxException import kotlin.math.min import kotlin.reflect.KClass +import org.intellij.lang.annotations.Language import org.jetbrains.annotations.NonNls import org.jetbrains.concurrency.Promise import org.jetbrains.concurrency.runAsync @@ -337,6 +339,18 @@ fun String.decapitalize(): String = replaceFirstChar { it.lowercase(Locale.ENGLISH) } +fun @receiver:Language("RegExp") String.toRegexOrNull(): Regex? { + return try { + this.toRegex() + } catch (_: PatternSyntaxException) { + null + } +} + +fun String.toRegexOrDefault(@Language("RegExp") default: String): Regex { + return this.toRegexOrNull() ?: default.toRegex() +} + // Bit of a hack, but this allows us to get the class object for top level declarations without having to // put the whole class name in as a string (easier to refactor, etc.) @Suppress("NOTHING_TO_INLINE") // In order for this to work this function must be `inline`