mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00

* Add MockAuthenticationService and ServerSelectionUITests. * Add tests covering the Authentication flow.
33 lines
865 B
Swift
33 lines
865 B
Swift
//
|
|
// MatrixEntitityRegex.swift
|
|
// ElementX
|
|
//
|
|
// Created by Stefan Ceriu on 26/03/2022.
|
|
// Copyright © 2022 Element. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
enum MatrixEntityRegex: String {
|
|
case homeserver
|
|
case userId
|
|
case roomAlias
|
|
case roomId
|
|
case eventId
|
|
|
|
var rawValue: String {
|
|
switch self {
|
|
case .homeserver:
|
|
return "[A-Z0-9]+((\\.|\\-)[A-Z0-9]+){0,}(:[0-9]{2,5})?"
|
|
case .userId:
|
|
return "@[\\x21-\\x39\\x3B-\\x7F]+:" + MatrixEntityRegex.homeserver.rawValue
|
|
case .roomAlias:
|
|
return "#[A-Z0-9._%#@=+-]+:" + MatrixEntityRegex.homeserver.rawValue
|
|
case .roomId:
|
|
return "![A-Z0-9]+:" + MatrixEntityRegex.homeserver.rawValue
|
|
case .eventId:
|
|
return "\\$[A-Z0-9]+:" + MatrixEntityRegex.homeserver.rawValue
|
|
}
|
|
}
|
|
}
|