21 lines
496 B
Swift
21 lines
496 B
Swift
//
|
|
// String+Regex.swift
|
|
// Wallet
|
|
//
|
|
// Created by Dmytro on 27.05.2021.
|
|
// Copyright © 2021 AM. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension String {
|
|
enum RegexString: String {
|
|
case accountName = "[a-zA-Z1-5]"
|
|
}
|
|
|
|
func matched(_ pattern: RegexString) -> Bool {
|
|
let range = NSRange(location: 0, length: self.utf16.count)
|
|
return (try? NSRegularExpression(pattern: pattern.rawValue))?.firstMatch(in: self, options: [], range: range) != nil
|
|
}
|
|
}
|