Pattern Groups ------------------------------------------------------------- ----------------------------------------------------------------------------
493951
function PatternGroup(patterns) {

    this._pattern = l.map(patterns, function(expr) {
        return Pattern.toPattern(expr);
    });

}
403354
public void addPattern(Pattern pattern) {
        if (patterns == null) {
            patterns = new ArrayList<Pattern>();
        }

        patterns.add(pattern);
    }
1105784
public function patterns($patterns)
    {
        foreach ($patterns as $key => $pattern) {
            $this->pattern($key, $pattern);
        }
    }
1136798
public static <T extends Collection<String>> T findAll(Pattern pattern, CharSequence content, int group, T collection) {
		if (null == pattern || null == content) {
			return null;
		}

		if (null == collection) {
			throw new NullPointerException("Null collection param provided!");
		}

		final Matcher matcher = pattern.matcher(content);
		while (matcher.find()) {
			collection.add(matcher.group(group));
		}
		return collection;
	}
993722
public List<Pattern52> getPatterns() {
        final List<Pattern52> patterns = new ArrayList<Pattern52>();
        for (CompositeColumn<?> cc : conditionPatterns) {
            if (cc instanceof Pattern52) {
                patterns.add((Pattern52) cc);
            }
        }
        return Collections.unmodifiableList(patterns);
    }
1005092
private void readPattern(JSONObject patternJson) {

        setPatternType(readPatternType(patternJson));
        setInterval(readOptionalInt(patternJson, JsonKey.PATTERN_INTERVAL));
        setWeekDays(readWeekDays(patternJson));
        setDayOfMonth(readOptionalInt(patternJson, JsonKey.PATTERN_DAY_OF_MONTH));
        setEveryWorkingDay(readOptionalBoolean(patternJson, JsonKey.PATTERN_EVERYWORKINGDAY));
        setWeeksOfMonth(readWeeksOfMonth(patternJson));
        setIndividualDates(readDates(readOptionalArray(patternJson, JsonKey.PATTERN_DATES)));
        setMonth(readOptionalMonth(patternJson, JsonKey.PATTERN_MONTH));

    }
66811
public void setPattern(String pattern) {
        if (pattern == null || pattern.length() <= 0) {
            throw new IllegalArgumentException(
                    "Pattern to search for can not be null or of length 0");
        }
        pattern_.text_ = pattern;
        initialize();
    }
1054707
function Pattern() {

    // Invoking with `new` this WILL not be able to construct all pattern types
    // like e.g. from objects, those must to through the toPattern() function instead
    if (this instanceof Pattern) {

        this._match = [];
        this._last = [];
        this._first = [];
        this._not = [];

        l.map(l.flatten(arguments), this.merge, this);

    } else {
        return Pattern.toPattern.apply(null, arguments);
    }

}
176431
function isNotAPattern(pattern) {
  let set = new Minimatch(pattern).set;
  if (set.length > 1) {
    return false;
  }

  for (let j = 0; j < set[0].length; j++) {
    if (typeof set[0][j] !== 'string') {
      return false;
    }
  }

  return true;
}
711848
private void createPattern() {
        atomTypePatterns.add(Pattern.compile("[CSP]-[0-4][-]?+;[A-Za-z+-]{0,6}[(].*+"));
        //Csp3
        atomTypePatterns.add(Pattern.compile("[CS]-[0-3];[H]{0,2}+[A-Za-z]*+=[A-Z]{1,2}+.*+"));
        //Csp2
        atomTypePatterns.add(Pattern.compile("C-[0-3];=O.*+"));
        //C carbonyl
        atomTypePatterns.add(Pattern.compile("C-[1-2][-]?+;[H]{0,1}+%.*+"));
        //csp
        atomTypePatterns.add(Pattern.compile("H-[0-1];[C].*+"));
        //H
        atomTypePatterns.add(Pattern.compile("[OS]-[0-2][-]?+;[A-Za-z]{1,4}+[+]?+[(].*+"));
        //O Ether,Alcohol
        atomTypePatterns.add(Pattern.compile("O-[1-2][+]?+;[H]{0,1}+=[SPC].[^O]++.*+"));
        //=0 Carbonyl
        atomTypePatterns.add(Pattern.compile("N-[0-3][+-]?+;[A-Z &&[^=%]]{1,3}+.*+"));
        //nsp3
        atomTypePatterns.add(Pattern.compile("N-[1-3][-+]?+;=?+[ON]?+[+]?+[CH]*+.(=O)?+.*+"));
        //nsp2amide
        atomTypePatterns.add(Pattern.compile("N-[1-2][+]?+;%.*+"));
        //nsp (10)
        atomTypePatterns.add(Pattern.compile("F.*+"));
        //F
        atomTypePatterns.add(Pattern.compile("Cl.*+"));
        //Cl
        atomTypePatterns.add(Pattern.compile("Br.*+"));
        //Br
        atomTypePatterns.add(Pattern.compile("I.*+"));
        //I
        atomTypePatterns.add(Pattern.compile("S-[1-2][-]?+;[HCSON]{1,2}+[(].*+"));
        //S Sulfide
        atomTypePatterns.add(Pattern.compile("S-3+;.?+[A-Za-z]++.*+"));
        //S+Sulfonium
        atomTypePatterns.add(Pattern.compile("S-[1-2][+]?+;=[OCNP][A-Z]++.*+"));
        //S=0
        atomTypePatterns.add(Pattern.compile("S-4;=O=O[A-Za-z]++.*+"));
        //So2
        atomTypePatterns.add(Pattern.compile("Si.*+"));
        //Silane
        atomTypePatterns.add(Pattern.compile("LP.*+"));
        //Lonepair (20)
        atomTypePatterns.add(Pattern.compile("H-1;O[+-]?+.[PSCN]{0,2}+/.*+"));
        //H- OH
        atomTypePatterns.add(Pattern.compile("C-3;CCC..?+&?+[A-Za-z]?+,?+.?+&?+,?+.?+&?+.*+"));
        //C Cyclopropane
        atomTypePatterns.add(Pattern.compile("H-1;[NP][+]?+[(][H]{0,2}+=?+[A-Z]{0,2}+/.*+"));
        //H- NH amine
        atomTypePatterns.add(Pattern.compile("H-1;O[+]?+.=?+C/=?+[OCSP]{1,2}+/.*+"));
        //H- COOH
        atomTypePatterns.add(Pattern.compile("P-[0-3];[A-Za-z]{1,3}[(].*+"));
        //>P
        atomTypePatterns.add(Pattern.compile("B-[0-3];[A-Za-z]{1,2}.*+"));
        //>B
        atomTypePatterns.add(Pattern.compile("B-4;[A-Za-z]{1,4}.*+"));
        //>B<
        atomTypePatterns.add(Pattern.compile("SPECIAL DEFINITON "));
        //H- Amide/Enol
        atomTypePatterns.add(Pattern.compile("NOT Implemented"));
        //C* Carbonradical
        atomTypePatterns.add(Pattern.compile("C-[0-9][+];.*+"));
        //C+ (30)
        atomTypePatterns.add(Pattern.compile("Ge.*+"));
        //Ge
        atomTypePatterns.add(Pattern.compile("Sn.*+"));
        //Sn
        atomTypePatterns.add(Pattern.compile("Pb.*+"));
        //Pb
        atomTypePatterns.add(Pattern.compile("Se.*+"));
        //Se
        atomTypePatterns.add(Pattern.compile("Te.*+"));
        //Te
        atomTypePatterns.add(Pattern.compile("D-1;.*+"));
        //D
        atomTypePatterns.add(Pattern.compile("N-2;=CC..*+"));
        //-N= azo,Pyridin
        atomTypePatterns.add(Pattern.compile("C-2;=CC..?+[A-Za-z]?+,?+&?+,?+C?+&?+.*+"));
        //Csp2 Cyclopropene
        atomTypePatterns.add(Pattern.compile("N-4[+]?+;.*+"));
        //nsp3 ammonium
        atomTypePatterns.add(Pattern.compile("N-[2-3];H?+CC.[^(=O)].*+"));
        //nsp2pyrrole (40)
        atomTypePatterns.add(Pattern.compile("O-2;CC.=C.*+&.*+&.*+"));
        //osp2furan
        atomTypePatterns.add(Pattern.compile("S-2;CC.*+"));
        //s sp2 thiophene
        atomTypePatterns.add(Pattern.compile("N-[2-3][+]?+;=N.*+C?+O?+[-]?+.*+"));
        //-N=N-O
        atomTypePatterns.add(Pattern.compile("H-1;S.*+"));
        //H- S hiol
        atomTypePatterns.add(Pattern.compile("N-2[+];=?+%?+[NC][-=]{0,2}+[NC][-]?+.*+"));
        //Azide Center n
        atomTypePatterns.add(Pattern.compile("N-3[+];=O[A-Z]-?+[A-Z]-?+.*+"));
        //n no2
        atomTypePatterns.add(Pattern.compile("O-1-?+;=?+[CS][(][=0]?+[OCSNH]*+/.*+"));
        //0 carboxylate
        atomTypePatterns.add(Pattern.compile("H-1;N[+].[A-Z]{0,3}+/.*+"));
        //h ammonium
        atomTypePatterns.add(Pattern.compile("O-2;CC.H?+,?+H?+,?+&,&.*+"));
        //Epoxy
        atomTypePatterns.add(Pattern.compile("C-2;=CC.*+"));
        //C Benzene (50)
        atomTypePatterns.add(Pattern.compile("He.*+"));
        //He
        atomTypePatterns.add(Pattern.compile("Ne.*+"));
        //Ne
        atomTypePatterns.add(Pattern.compile("Ar.*+"));
        //Ar
        atomTypePatterns.add(Pattern.compile("Kr.*+"));
        //Kr
        atomTypePatterns.add(Pattern.compile("Xe.*+"));
        //Xe
        atomTypePatterns.add(Pattern.compile("NotImplemented"));
        atomTypePatterns.add(Pattern.compile("NotImplemented"));
        atomTypePatterns.add(Pattern.compile("NotImplemented"));
        atomTypePatterns.add(Pattern.compile("Mg.*+"));
        //Mg
        atomTypePatterns.add(Pattern.compile("P-[2-4];.*"));
        //P (60)
        atomTypePatterns.add(Pattern.compile("Fe.*+"));
        //Fe 2
        atomTypePatterns.add(Pattern.compile("Fe.*+"));
        //Fe 3
        atomTypePatterns.add(Pattern.compile("Ni.*+"));
        //Ni 2
        atomTypePatterns.add(Pattern.compile("Ni.*+"));
        //Ni 3
        atomTypePatterns.add(Pattern.compile("Co.*+"));
        //Co 2
        atomTypePatterns.add(Pattern.compile("Co.*+"));
        //Co 3
        atomTypePatterns.add(Pattern.compile("NotImplemented"));
        atomTypePatterns.add(Pattern.compile("NotImplemented"));
        atomTypePatterns.add(Pattern.compile("O-1[-]?+;=?+N.*+"));
        //Amineoxide
        atomTypePatterns.add(Pattern.compile("O-3[+];[H]{0,3}+[C]{0,3}+[(].*+"));
        //Ketoniumoxygen (70)
        atomTypePatterns.add(Pattern.compile("C-1NotImplemented"));
        //Ketoniumcarbon
        atomTypePatterns.add(Pattern.compile("N-2;=C[^CO].*+"));
        //N =N-Imine,Oxime
        atomTypePatterns.add(Pattern.compile("N-3[+];[H]{0,2}+=?+[C]{0,3}+[(].*+"));
        //N+ =N+Pyridinium
        atomTypePatterns.add(Pattern.compile("N-[2-3][+];=C[CO]{2}+.?+[(].*+"));
        //N+ =N+Imminium
        atomTypePatterns.add(Pattern.compile("N-[2-3][+]?+;=CO.*+"));
        //N-0H Oxime
        atomTypePatterns.add(Pattern.compile("H-1;N[(]{1}+[CH]{2,2}+/[H]{0,3}+[,]?+=OC.*+"));
        //H- Amide
        atomTypePatterns.add(Pattern.compile("H-1;O.C/=CC/.*+"));
        //H- AEnol (77)
        atomTypePatterns.add(Pattern.compile("N-[1-3];[CH]{1,3}.{1}+[A-Z]{0,3}+[,]?+=OC.*+"));
        //amid
    }
1032917
private ProcPattern createPattern(Pattern pattern) {
        if (pattern.isEmpty()) {
            throw new IllegalStateException("Pattern elements list can't be empty.");
        }

        List<ProcPatternElement> elements = new ArrayList<ProcPatternElement>();
        for (PatternElement element : pattern.getElements()) {
            elements.add(patternElementFactory.create(element));
        }
        return new ProcPattern(elements);
    }
1171161
private void replacePattern(
      NodeTraversal t, Node pattern, Node rhs, Node parent, Node nodeToDetach) {
    checkArgument(NodeUtil.isStatement(nodeToDetach), nodeToDetach);
    switch (pattern.getToken()) {
      case ARRAY_PATTERN:
        replaceArrayPattern(t, pattern, rhs, parent, nodeToDetach);
        break;
      case OBJECT_PATTERN:
        replaceObjectPattern(t, pattern, rhs, parent, nodeToDetach);
        break;
      default:
        throw new IllegalStateException("unexpected");
    }
  }
1127841
private function getPatternId() : string
    {
        return sprintf(
            '%s::u%d::c%d::d%s::p%s',
            $this->patternId['division'],
            $this->patternId['useragent'],
            $this->patternId['child'],
            $this->patternId['device'],
            $this->patternId['platform']
        );
    }
526272
function () {
        this._patterns
            .map(pattern => this._getPatternLayers(pattern))
            .forEach(layers => { this.addLayer(L.featureGroup(layers)); });
    }
624579
protected function processGroups() : string
    {
        $pattern = "";
        foreach ($this->routeGroups as $group) {
            $pattern .= $group->getPattern();
        }

        return $pattern;
    }
260030
function createPatternVariations(pattern) {
    var lastCharIdx = pattern.length - 1,
        patternVariations = [pattern, '!' + pattern];

    if (pattern[lastCharIdx] === '/') {
        var unslashed = pattern.substring(0, lastCharIdx);

        patternVariations.push(unslashed);
        patternVariations.push('!' + unslashed);
    }

    return patternVariations;
}
675933
function (patternFolder, patterns, cb) {
    getSourceFile(function generatePatterns(content) {
      patterns.forEach(function (file) {
        content += '<hr/>';
        content += '<div class="pattern"><div class="display">';
        content += file.content;
        content += '</div><div class="source"><textarea rows="6" cols="30">';
        content += simpleEscaper(file.content);
        content += '</textarea>';
        content += '<p><a href="/'+ patternFolder + '/' + file.filename +'">' + file.filename + '</a></p>';
        content += '</div></div>';
      });
      content += '</body></html>';
      cb(content);
    });
  }