     }
 }
 
+/// Regular expression matcher based on pcre2
 public class RegEx {
     private let compiled: COpaquePointer
     
+    /// Errors that may be thrown by initializer
     enum Error: ErrorType {
+        /// Invalid pattern, contains error offset and error message from pcre2 engine
         case InvalidPattern(errorOffset: Int, errorMessage: String)
     }
     
+    /// Initialize RegEx with pattern
+    ///
+    /// - parameter pattern: Regular Expression pattern
+    /// - throws: RegEx.Error.InvalidPattern when pattern is invalid
     public init(pattern: String) throws {
         let tmp = [UInt8].fromString(pattern)
         

        pcre2_code_free_8(self.compiled)
    }
    
    public func match(string: String) -> (numberedParams:[String], namedParams:[String:String]) {
        let match_data = pcre2_match_data_create_from_pattern_8(self.compiled, nil)
        defer {

//
//  regex.swift
//  SwiftyRegex
//
//  Created by Johannes Schriewer on 06/12/15.
//  Copyright © 2015 Johannes Schriewer. All rights reserved.
//

import pcre2

/// internal extension to convert a string to an integer array
extension SequenceType where Generator.Element == UInt8 {
    static func fromString(string: String) -> [UInt8] {
        var temp = [UInt8]()
