mirror of
https://github.com/samsonjs/SwiftBatteries.git
synced 2026-03-25 09:25:51 +00:00
14 lines
394 B
Swift
14 lines
394 B
Swift
import Foundation
|
|
|
|
public extension NSRegularExpression {
|
|
|
|
func match(string: String) -> [NSTextCheckingResult] {
|
|
let range = NSRange(location: 0, length: string.characters.count)
|
|
return self.matchesInString(string, options: NSMatchingOptions(rawValue: 0), range: range)
|
|
}
|
|
|
|
func matches(string: String) -> Bool {
|
|
return self.match(string).count > 0
|
|
}
|
|
|
|
}
|