 import Regex
 
 public enum Manifest {
+
+    static let previousPackagesRegex = Regex("url: \"(\\S+)\",(.+)\\)")
+    static let dependenciesRegex = Regex("dependencies:\\s?\\[")
+    static let singleLineDependenciesRegex = Regex("dependencies:\\s?\\[ *\\]")
+    static let targetsRegex = Regex("target\\(", options: .ignoreCase)
 
     public enum Error: Swift.Error {
         case unsupportedLayout(reason: String)

    }

    public static func insert(package: Repository, requirement: Requirement, into manifest: String) throws -> String {
        guard !manifest.contains(package.nameWithOwner) else { throw Error.packageAlreadyExists }

        let swiftVersion = SwiftVersion.guessVersion(fromPackageContents: manifest)
        let (line, indentation) = try findDependenciesInsertLocation(in: manifest)

            return (lastPackageLocation + 1, 8)
        } else {
            // List of dependencies is either empty or non-existant

            guard let dependenciesListLocation = dependenciesRegex.lineNumbersOfMatches(in: manifest).first else {
                throw Error.unsupportedLayout(reason: "Found no list of dependencies. Please make sure your Package.swift includes at least an empty list of dependencies.")
