From 74ff612ac06ba054f83bd23363bb27d6eeb23f3d Mon Sep 17 00:00:00 2001 From: Joshua Alvarado Date: Sat, 29 Jun 2019 20:51:19 -0700 Subject: [PATCH] Add init with empty components to Regex.Match --- Sources/Regex.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/Regex.swift b/Sources/Regex.swift index 8b19870..3ea4523 100644 --- a/Sources/Regex.swift +++ b/Sources/Regex.swift @@ -26,6 +26,14 @@ public struct Regex { /// A collection of a tuple object with a value of the substring and the range of that substring from the string it was matched in/ public let components: [(String, Range)] + public init() { + components = [(String, Range)]() + } + + public init(components: [(String, Range)]) { + self.components = components + } + /// A collection of just the substrings that were found in the match. public func subStrings() -> [String] { return components.map {