     ///
     /// - Parameter regex: Regex to check for.
     /// - Returns: Returns the match (if any).
-    internal func firstMatch(regex: String) -> String? {
+    public func firstMatch(regex: String) -> String? {
         guard let range = self.range(of: regex, options: .regularExpression) else {
             return nil
         }

// MARK: - Convenience for optional strings.
extension Optional where Wrapped: ExpressibleByStringLiteral {
    /// Falls back to an empty string if no value is found.
    internal var safeUnwrap: String {
        guard let string = self as? String else {
            return ""
        }

    ///
    /// - Parameter regex: Regex to check for.
    /// - Returns: A bool telling if the regex had any matches.
    public func isMatching(regex: String) -> Bool {
        return self.range(of: regex, options: .regularExpression) != nil
    }
    
    /// The string being url encoded.
    public func urlEncoded() throws -> String {
        return self.addingPercentEncoding(withAllowedCharacters: CharacterSet())!
    }
}
