/*
 * regex-pill
 * https://github.com/lgoldstien/regex-pill
 *
 * Copyright (c) 2014 Lawrence Goldstien
 * Licensed under the MIT license.
 */

'use strict';

var RegexLibraryContents = {
    "hostnames":{
        "databases": {
            "mongodb": /^(mongodb:\/\/)([a-z0-9]+:[a-z0-9]+@)?([a-zA-Z0-9-_.]+)(:[0-9]+)?(\/[a-z_-]+)?$/g,
        }
    }
};


var RegexLibrary = function () {

};

RegexLibrary.prototype.get = function (name) {
    this._selectedRegex = name;
};

module.exports = RegexLibrary;

@@ -200,48 +200,19 @@
 ames
-%22:%7B%0A        %22databases%22: %7B%0A            %22
+/databases/
 mong
@@ -305,62 +305,475 @@
 /g,%0A
-        %7D%0A    %7D%0A%7D;%0A%0A%0Avar RegexLibrary = function () %7B%0A
+%7D;%0A%0A%0Avar RegexLibrary = function (value, name) %7B%0A    if (!value)%0A        throw new ReferenceError(%22A value should be passed to this constructor.%22);%0A%0A    this._value = value;%0A%0A    if (name)%0A        this.setRegex(name);%0A%0A    return this;%0A%7D;%0A%0ARegexLibrary.prototype.isValid = function () %7B%0A    var regex;%0A%0A    if (!this._selectedRegex.regex)%0A        throw new ReferenceError(%22Cannot validate against a non-existant regex.%22);%0A%0A    regex = this._selectedRegex.regex;%0A%0A    
 %0A%7D;%0A
@@ -800,11 +800,16 @@
 ype.
-g
+s
 et
+Regex
  = f
@@ -854,14 +854,201 @@
 ex =
+ %7B
  name
-;
+: name %7D;%0A%0A    (RegexLibraryContents%5Bthis._selectedRegex.name%5D) ?%0A        this._selectedRegex.regex = RegexLibraryContents%5Bthis._selectedRegex.name%5D :%0A        this._selectedRegex = %7B%7D;%0A%0A
 %0A%7D;%0A

Add some improvements to assigning regex, begin validate method