 
 // MARK: Path parsing
 
-private let pathSplitter = Regex(pattern: "([a-zA-z])([^a-df-zA-DF-Z]*)")
-private let pathArgSplitter = Regex(pattern: "([+-]?\\d*\\.?\\d*(?:[eE][+-]?\\d+)?)\\s*,?\\s*")
+private let pathSplitter = SVGRegex(pattern: "([a-zA-z])([^a-df-zA-DF-Z]*)")
+private let pathArgSplitter = SVGRegex(pattern: "([+-]?\\d*\\.?\\d*(?:[eE][+-]?\\d+)?)\\s*,?\\s*")
 
 private enum PathInstruction {
   case ClosePath

  var range : NSRange { return result.range }
}

private class Regex {
  let re : NSRegularExpression
  init(pattern: String) {
    re = try! NSRegularExpression(pattern: pattern, options: NSRegularExpressionOptions())
  }
  func firstMatchInString(string : String) -> Match? {
    let nss = string as NSString
    if let tr = re.firstMatchInString(string, options: NSMatchingOptions(), range: NSRange(location: 0, length: nss.length)) {
      return Match(string: string, result: tr)
    }
    return nil
  }
  func matchesInString(string : String) -> [Match] {
    let nsS = string as NSString
    return re.matchesInString(string, options: NSMatchingOptions(), range: NSRange(location: 0, length: nsS.length)).map { Match(string: string, result: $0) }
  }
}


  return CGPointMake(left.x + right.x, left.y + right.y)
}

private struct SVGRegexMatch {
  var groups : [String]
  var result : NSTextCheckingResult
  
