Приложение

This commit is contained in:
Халимов Рустам
2026-04-14 01:15:54 +03:00
parent 8399d32490
commit 1fb1be47dd
126 changed files with 6145 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
package core.utils
data class LinkMetadata(
val url: String,
val title: String? = null,
val description: String? = null,
val imageUrl: String? = null
)
object LinkParser {
private val URL_PATTERN = Regex(
"(?:^|[\\s])((https?://)[\\w-]+(\\.[\\w-]+)+\\.?(:\\d+)?(/[\\w- ./?%&=]*)?)",
RegexOption.IGNORE_CASE
)
fun findLinks(text: String): List<String> {
return URL_PATTERN.findAll(text).map { it.groupValues[1].trim() }.toList()
}
}