MatrixPatterns

object MatrixPatterns

This class contains pattern to match the different Matrix ids Ref: https://matrix.org/docs/spec/appendices#identifier-grammar

Functions

Link copied to clipboard
fun candidateAliasFromRoomName(roomName: String, domain: String): String
Link copied to clipboard
fun extractServerNameFromId(matrixId: String?): String?

Extract server name from a matrix id.

Link copied to clipboard
fun extractUserNameFromId(matrixId: String): String?

Extract user name from a matrix id.

Link copied to clipboard
fun String.getServerName(): String

Return the domain form a userId. Examples:

Link copied to clipboard
fun isEventId(str: String?): Boolean

Tells if a string is a valid event id.

Link copied to clipboard
fun isGroupId(str: String?): Boolean

Tells if a string is a valid group id.

Link copied to clipboard
fun isPermalink(str: String?): Boolean
Link copied to clipboard
fun isRoomAlias(str: String?): Boolean

Tells if a string is a valid room alias.

Link copied to clipboard
fun isRoomId(str: String?): Boolean

Tells if a string is a valid room id.

Link copied to clipboard
fun isUserId(str: String?): Boolean

Tells if a string is a valid user Id.

Link copied to clipboard
fun isValidOrderString(order: String?): Boolean

Orders which are not strings, or do not consist solely of ascii characters in the range \x20 (space) to \x7E (~), or consist of more than 50 characters, are forbidden and the field should be ignored if received.

Properties

Link copied to clipboard
val MATRIX_PATTERNS: List<Regex>
Link copied to clipboard
val ORDER_STRING_REGEX: Regex
Link copied to clipboard
val PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER: Regex
Link copied to clipboard
const val SEP_REGEX: String