UrlDetector

internal object UrlDetector

Detects URLs in text using the AOSP Patterns.WEB_URL regex, ported to commonMain for iOS parity.

The regex pattern is vendored from Android Open Source Project (AOSP) to ensure byte-identical detection results across Android and iOS platforms. See docs/adr/ for source URL and revision.

Reference: android.util.Patterns.WEB_URL (Apache License 2.0) https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/util/Patterns.java

Types

Link copied to clipboard
data class UrlMatch(val url: String, val start: Int, val end: Int)

Functions

Link copied to clipboard
fun detect(text: String, excluded: List<IntRange> = emptyList()): List<UrlDetector.UrlMatch>

Detects URLs in the given text, excluding ranges.