RegexMatchResult
public struct RegexMatchResult: SequenceType, BooleanType
An object representing the result of searching a given String
using a Regex
.
-
Returns
true
if the number of matches is greater than zero.Declaration
Swift
public var boolValue: Bool { return items.count > 0 }
-
Returns the
i
th match as anNSTextCheckingResult
.Declaration
Swift
subscript (i: Int) -> NSTextCheckingResult
-
Returns the captured text of the
i
th 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
String
s. 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
regex
The
NSRegularExpression
that was used to create thisRegexMatchResult
.searchString
The string that was searched by
regex
to generate these results.items
The array of
NSTextCheckingResult
s generated byregex
while searchingsearchString
. -
Returns a
Generator
that iterates over the captured matches asNSTextCheckingResult
s.Declaration
Swift
public func generate() -> AnyGenerator<NSTextCheckingResult>
-
Returns a
Generator
that iterates over the captured matches asString
s.Declaration
Swift
public func generateCaptures() -> AnyGenerator<String>