TODO not a very good pattern..
422516
def method_missing(method, *args, &block)
      @setting ||= LocalSettings.new
      @setting.send(method, *args, &block)
    end
470062
Node tryOptimizeArrayPattern(Node pattern) {
    checkArgument(pattern.isArrayPattern(), pattern);

    for (Node lastChild = pattern.getLastChild(); lastChild != null; ) {
      if (lastChild.isEmpty() || isRemovableDestructuringTarget(lastChild)) {
        Node prev = lastChild.getPrevious();
        pattern.removeChild(lastChild);
        lastChild = prev;
        reportChangeToEnclosingScope(pattern);
      } else {
        // don't remove any non-trailing empty nodes because that will change the ordering of the
        // other assignments
        // note that this case also covers array pattern rest, which must be the final element
        break;
      }
    }
    return pattern;
  }
234223
public ZealotKhala notLikePattern(String field, String pattern) {
        return this.doLikePattern(ZealotConst.ONE_SPACE, field, pattern, true, false);
    }
90296
private String format(final String pattern, final Object argument) {
		try {
			return getFormatter(pattern, argument).format(argument);
		} catch (IllegalArgumentException ex) {
			InternalLogger.log(Level.WARN, "Illegal argument '" + String.valueOf(argument) + "' for pattern '" + pattern + "'");
			return String.valueOf(argument);
		}
	}
455166
function regexpPattern(pattern) {
  if (!pattern) {
    return pattern;
  }
  // A very simplified glob transform which allows passing legible strings like
  // "myPath/*.js" instead of a harder to read RegExp like /\/myPath\/.*\.js/.
  if (typeof pattern === 'string') {
    pattern = pattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
    if (pattern[0] !== '/') {
      pattern = '/' + pattern;
    }
    return new RegExp(pattern);
  }
  if (typeof pattern.test === 'function') {
    return pattern;
  }
  throw new Error(
    'flow-remove-types: includes and excludes must be RegExp or path strings. Got: ' + pattern
  );
}
766131
function normalizePattern(
  pattern /*: string*/,
) /*: {
  hasVersion: boolean,
  name: string,
  range: string,
}*/ {
  let hasVersion = false
  let range = 'latest'
  let name = pattern

  // if we're a scope then remove the @ and add it back later
  let isScoped = false
  if (name[0] === '@') {
    isScoped = true
    name = name.slice(1)
  }

  // take first part as the name
  const parts = name.split('@')
  if (parts.length > 1) {
    name = parts.shift()
    range = parts.join('@')

    if (range) {
      hasVersion = true
    } else {
      range = '*'
    }
  }

  // add back @ scope suffix
  if (isScoped) {
    name = `@${name}`
  }

  return {name, range, hasVersion}
}
1058727
protected Pattern[] queryDetectionPattern(final Pattern... pattern) {
        if (pattern == null) {
            throw new IllegalArgumentException();
        } // end of if

        // ---

        if (this.queryDetection == null) {
            return pattern;
        } // end of if

        // ---

        final Pattern[] patterns = 
            new Pattern[this.queryDetection.length + pattern.length];

        System.arraycopy(this.queryDetection, 0, 
                         patterns, 0, 
                         this.queryDetection.length);

        int i = this.queryDetection.length;

        for (final Pattern p : pattern) {
            patterns[i++] = p;
        } // end of for

        return patterns;
    }
207529
function simple(matches, pattern, file) {
  var note = pattern.note
  var id = pattern.id
  var length = matches.length
  var index = -1
  var match
  var nodes

  while (++index < length) {
    match = matches[index]
    nodes = match.nodes

    warn(
      file,
      id,
      toString(nodes),
      pattern.considerate,
      nodes[0],
      note,
      pattern.condition
    )
  }
}
770601
private Pattern getPattern(String expr)
    {
        Pattern pattern = patterns.get(expr);
        if(pattern == null)
        {
            pattern = Pattern.compile(expr);
            patterns.put(expr, pattern);
        }
        return pattern;
    }
185920
@Override
	public Pattern constructPattern()
	{
		Pattern p = new Pattern(SequenceEntityReference.class, "controller ER");
		p.add(isHuman(), "controller ER");
		p.add(linkedER(true), "controller ER", "controller generic ER");
		p.add(erToPE(), "controller generic ER", "controller simple PE");
		p.add(linkToComplex(), "controller simple PE", "controller PE");
		p.add(peToControl(), "controller PE", "Control");
		p.add(controlToInter(), "Control", "Interaction");
		p.add(new NOT(participantER()), "Interaction", "controller ER");
		p.add(participant(), "Interaction", "affected PE");
		p.add(linkToSpecific(), "affected PE", "affected simple PE");
		p.add(new Type(SequenceEntity.class), "affected simple PE");
		p.add(peToER(), "affected simple PE", "affected generic ER");
		p.add(peToER(), "affected generic ER", "affected ER");

		return p;
	}
860742
def simple_pattern(self, pattern, field=None):
        
        return self.get_allowed_value(lambda: self.faker.bothify(pattern), field)
1213385
private void  fillWithPattern(SvgElement obj, Path path, Pattern pattern)
   {
      boolean      patternUnitsAreUser = (pattern.patternUnitsAreUser != null && pattern.patternUnitsAreUser);
      float        x, y, w, h;
      float        originX, originY;

      if (pattern.href != null)
         fillInChainedPatternFields(pattern, pattern.href);

      if (patternUnitsAreUser)
      {
         x = (pattern.x != null) ? pattern.x.floatValueX(this): 0f;
         y = (pattern.y != null) ? pattern.y.floatValueY(this): 0f;
         w = (pattern.width != null) ? pattern.width.floatValueX(this): 0f;
         h = (pattern.height != null) ? pattern.height.floatValueY(this): 0f;
      }
      else
      {
         // Convert objectBoundingBox space to user space
         x = (pattern.x != null) ? pattern.x.floatValue(this, 1f): 0f;
         y = (pattern.y != null) ? pattern.y.floatValue(this, 1f): 0f;
         w = (pattern.width != null) ? pattern.width.floatValue(this, 1f): 0f;
         h = (pattern.height != null) ? pattern.height.floatValue(this, 1f): 0f;
         x = obj.boundingBox.minX + x * obj.boundingBox.width;
         y = obj.boundingBox.minY + y * obj.boundingBox.height;
         w *= obj.boundingBox.width;
         h *= obj.boundingBox.height;
      }
      if (w == 0 || h == 0)
         return;

      // "If attribute 'preserveAspectRatio' is not specified, then the effect is as if a value of xMidYMid meet were specified."
      PreserveAspectRatio  positioning = (pattern.preserveAspectRatio != null) ? pattern.preserveAspectRatio : PreserveAspectRatio.LETTERBOX;

      // Push the state
      statePush();
      // Set path as the clip region
      canvas.clipPath(path);

      // Set the style for the pattern (inherits from its own ancestors, not from callee's state)
      RendererState  baseState = new RendererState();
      updateStyle(baseState, Style.getDefaultStyle());
      baseState.style.overflow = false;    // By default patterns do not overflow

      // SVG2 TODO: Patterns now inherit from the element referencing the pattern
      state = findInheritFromAncestorState(pattern, baseState);

      // The bounds of the area we need to cover with pattern to ensure that our shape is filled
      Box  patternArea = obj.boundingBox;
      // Apply the patternTransform
      if (pattern.patternTransform != null)
      {
         canvas.concat(pattern.patternTransform);
         
         // A pattern transform will affect the area we need to cover with the pattern.
         // So we need to alter the area bounding rectangle.
         Matrix inverse = new Matrix();
         if (pattern.patternTransform.invert(inverse)) {
            float[] pts = {obj.boundingBox.minX, obj.boundingBox.minY,
                           obj.boundingBox.maxX(), obj.boundingBox.minY,
                           obj.boundingBox.maxX(), obj.boundingBox.maxY(),
                           obj.boundingBox.minX, obj.boundingBox.maxY()};
            inverse.mapPoints(pts);
            // Find the bounding box of the shape created by the inverse transform 
            RectF  rect = new RectF(pts[0], pts[1], pts[0], pts[1]);
            for (int i=2; i<=6; i+=2) {
               if (pts[i] < rect.left) rect.left = pts[i]; 
               if (pts[i] > rect.right) rect.right = pts[i]; 
               if (pts[i+1] < rect.top) rect.top = pts[i+1]; 
               if (pts[i+1] > rect.bottom) rect.bottom = pts[i+1]; 
            }
            patternArea = new Box(rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top);
         }
      }

      // Calculate the pattern origin
      originX = x + (float) Math.floor((patternArea.minX - x) / w) * w;
      originY = y + (float) Math.floor((patternArea.minY - y) / h) * h;

      // For each Y step, then each X step
      float  right = patternArea.maxX();
      float  bottom = patternArea.maxY();
      Box    stepViewBox = new Box(0,0,w,h);

      boolean  compositing = pushLayer();

      for (float stepY = originY; stepY < bottom; stepY += h)
      {
         for (float stepX = originX; stepX < right; stepX += w)
         {
            stepViewBox.minX = stepX;
            stepViewBox.minY = stepY;

            // Push the state
            statePush();

            // Set pattern clip rectangle if appropriate
            if (!state.style.overflow) {
               setClipRect(stepViewBox.minX, stepViewBox.minY, stepViewBox.width, stepViewBox.height);
            }
            // Calculate and set the viewport for each instance of the pattern
            if (pattern.viewBox != null)
            {
               canvas.concat(calculateViewBoxTransform(stepViewBox, pattern.viewBox, positioning));
            }
            else
            {
               boolean  patternContentUnitsAreUser = (pattern.patternContentUnitsAreUser == null || pattern.patternContentUnitsAreUser);
               // Simple translate of pattern to step position
               canvas.translate(stepX, stepY);
               if (!patternContentUnitsAreUser) {
                  canvas.scale(obj.boundingBox.width, obj.boundingBox.height);
               }
            }


            // Render the pattern
            for (SVG.SvgObject child: pattern.children) {
               render(child);
            }

            // Pop the state
            statePop();
         }
      }

      if (compositing)
         popLayer(pattern);

      // Pop the state
      statePop();
   }
200055
function getPattern(type_, limit) {
      if (!type_) return;
      if (isUdf(limit)) limit = true;
      if (contains(['all', 'list'], type_)) return keys(patterns);
      if (!has(patterns, type_)) return UDF;
      var pattern = patterns[type_];
      return limit ? new RegExp('^(' + pattern.source.replace(/^(\^|\$)$/mg, '') + ')$') : pattern;
    }
493951
function PatternGroup(patterns) {

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

}
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");
    }
  }
650601
private final boolean matchPattern(byte[][] patterns, int bufferIndex)
   {
      boolean match = false;
      for (byte[] pattern : patterns)
      {
         int index = 0;
         match = true;
         for (byte b : pattern)
         {
            if (b != m_buffer[bufferIndex + index])
            {
               match = false;
               break;
            }
            ++index;
         }
         if (match)
         {
            break;
         }
      }
      return match;
   }
431754
function pattern (val, pat) {
  if (typeof pat !== 'string') { return false }

  var match = pat.match(new RegExp('^/(.*?)/([gimy]*)$'));
  if (!match) { return false }

  return new RegExp(match[1], match[2]).test(val)
}