Speeding up regex

pull/549/head
Vitor Pamplona 2023-08-12 18:15:45 -04:00
rodzic eec87f017a
commit 3be34d0d40
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -179,7 +179,7 @@ class RichTextParser() {
BechSegment(word)
} else if (word.startsWith("#")) {
parseHash(word, tags)
} else if (schemelessMatcher.find()) {
} else if (word.contains(".") && schemelessMatcher.find()) {
val url = schemelessMatcher.group(1) // url
val additionalChars = schemelessMatcher.group(4) // additional chars
val pattern = "^([A-Za-z0-9-_]+(\\.[A-Za-z0-9-_]+)+)(:[0-9]+)?(/[^?#]*)?(\\?[^#]*)?(#.*)?".toRegex(RegexOption.IGNORE_CASE)