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 ith match as an NSTextCheckingResult.

    Declaration

    Swift

    subscript (i: Int) -> NSTextCheckingResult
  • Returns the captured text of the ith match as a String.

    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’s String.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 this RegexMatchResult.

    searchString

    The string that was searched by regex to generate these results.

    items

    The array of NSTextCheckingResults generated by regex while searching searchString.

  • Returns a Generator that iterates over the captured matches as NSTextCheckingResults.

    Declaration

    Swift

    public func generate() -> AnyGenerator<NSTextCheckingResult>
  • Returns a Generator that iterates over the captured matches as Strings.

    Declaration

    Swift

    public func generateCaptures() -> AnyGenerator<String>