RegexMatchResult
public struct RegexMatchResult: SequenceType, BooleanType
An object representing the result of searching a given String using a Regex.
-
Returns
trueif the number of matches is greater than zero.Declaration
Swift
public var boolValue: Bool { return items.count > 0 } -
Returns the
ith match as anNSTextCheckingResult.Declaration
Swift
subscript (i: Int) -> NSTextCheckingResult -
Returns the captured text of the
ith match as aString.Declaration
Swift
subscript (i: Int) -> String -
Undocumented
Declaration
Swift
public struct RegexMatchResult: SequenceType, BooleanType -
Undocumented
Declaration
Swift
public struct RegexMatchResult: SequenceType, BooleanType -
Undocumented
Declaration
Swift
public struct RegexMatchResult: SequenceType, BooleanType -
An array of the captures as
Strings. Ordering is the same as the return value of Javascript’sString.match()method.Declaration
Swift
public let captures: [String] -
The designated initializer.
Declaration
Swift
public init (regex r:NSRegularExpression, searchString s:String, items i:[NSTextCheckingResult])Parameters
regexThe
NSRegularExpressionthat was used to create thisRegexMatchResult.searchStringThe string that was searched by
regexto generate these results.itemsThe array of
NSTextCheckingResults generated byregexwhile searchingsearchString. -
Returns a
Generatorthat iterates over the captured matches asNSTextCheckingResults.Declaration
Swift
public func generate() -> AnyGenerator<NSTextCheckingResult> -
Returns a
Generatorthat iterates over the captured matches asStrings.Declaration
Swift
public func generateCaptures() -> AnyGenerator<String>
View on GitHub
RegexMatchResult Struct Reference