endregion 
@param {String} pattern

@class _GpfLikeContext
@constructor
420798
function _GpfPathMatcher (pattern) {
    /*jshint validthis:true*/
/*#ifdef(DEBUG)*/
    this._dbgSource = pattern;
/*#endif*/

    if ("!" === pattern.charAt(0)) {
        this.negative = true;
        pattern = pattern.substr(1);
    }

    _gpfCheckPathMatcherGeneric(this, pattern);
}
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();
   }
191390
function(context, coords) {
		context.beginPath();
		context.moveTo(coords[0], coords[1]);
		context.lineTo(coords[2], coords[3]);
		context.lineTo(coords[4], coords[5]);
		context.closePath();
	}
82027
function(pattern, callback) {
    glob(pattern, opts, function(err, globbedFiles) {
      if (isArray(globbedFiles) && globbedFiles.length && !err) {
        callback(null, globbedFiles);
      }
      else {
        console.error('The glob pattern ' + JSON.stringify(pattern) + ' did not match any files!');
        callback(null, []);
      }
    });
  }
1312604
protected void setStopPattern (String pattern)
    {
        _stopMatcher = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE).matcher("");
    }
1160627
private void fromExpression(PatternDescrBuilder<?> pattern) throws RecognitionException {
        String expr = conditionalOrExpression();
        if (state.failed)
            return;

        if (state.backtracking == 0) {
            pattern.from().expression(expr);
            if (input.LA(1) != DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
            }
        }
    }
438338
function checkPattern(sections) {
	var length = sections.length;
	for (var index = 0; index < length; index++) {
		var current = sections[index];
		if (current[0] === WILDCARD_ALL) {
			if (!isLast(sections, index))
				throw new TypeError("# wildcard can only be at the end of a pattern. In: " + sections.join("/"));
		}
	}
}
486823
public static String removeZones(String pattern) {

        boolean literal = false;
        StringBuilder sb = new StringBuilder();

        for (int i = 0, n = pattern.length(); i < n; i++) {
            char c = pattern.charAt(i);

            if (c == '\'') {
                if (i + 1 < n && pattern.charAt(i + 1) == '\'') {
                    sb.append(c);
                    i++;
                } else {
                    literal = !literal;
                }
                sb.append(c);
            } else if (literal) {
                sb.append(c);
            } else if (c != 'z' && c != 'Z' && c != 'v' && c != 'V' && c != 'x' && c != 'X') {
                sb.append(c);
            }
        }

        for (int j = 0; j < sb.length(); j++) {
            char c = sb.charAt(j);

            if (c == ' ' && j + 1 < sb.length() && sb.charAt(j + 1) == ' ') {
                sb.deleteCharAt(j);
                j--;
            } else if (c == '[' || c == ']' || c == '(' || c == ')') { // check locales es, fa, ps, uz
                sb.deleteCharAt(j);
                j--;
            }
        }

        String result = sb.toString().trim();

        if (result.endsWith(" '")) { // special case for de, fr_BE
            result = result.substring(0, result.length() - 2) + "'";
        } else if (result.endsWith(",")) { // special case for hy
            result = result.substring(0, result.length() - 1);
        }

        return result;

    }
1311843
@Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        if (null != qName) {
            switch (qName) {
                case SUPPRESS:
                    if (rule.getUntil() != null && rule.getUntil().before(Calendar.getInstance())) {
                        LOGGER.info("Suppression is expired for rule: {}", rule);
                    } else {
                        suppressionRules.add(rule);
                    }
                    rule = null;
                    break;
                case FILE_PATH:
                    rule.setFilePath(processPropertyType());
                    break;
                case SHA1:
                    rule.setSha1(currentText.toString());
                    break;
                case GAV:
                    rule.setGav(processPropertyType());
                    break;
                case CPE:
                    rule.addCpe(processPropertyType());
                    break;
                case CWE:
                    rule.addCwe(currentText.toString());
                    break;
                case CVE:
                    rule.addCve(currentText.toString());
                    break;
                case NOTES:
                    rule.addNotes(currentText.toString());
                    break;
                case CVSS_BELOW:
                    final float cvss = Float.parseFloat(currentText.toString());
                    rule.addCvssBelow(cvss);
                    break;
                default:
                    break;
            }
        }
    }
1200804
function(panels, patternData, iframePassback, switchText) {

    // set-up defaults
    var template, templateCompiled, templateRendered;
    var annotation, comment, count, div, els, item, markup, i;
    var patternPartial = patternData.patternPartial;
    patternData.panels = panels;
    
    // set a default pattern description for modal pop-up
    if (!iframePassback && (patternData.patternDesc.length === 0)) {
      patternData.patternDesc = "This pattern doesn't have a description.";
    }

    // capitilize the pattern name
    patternData.patternNameCaps = patternData.patternName.toUpperCase();

    // check for annotations in the given mark-up
    markup           = document.createElement('div');
    markup.innerHTML = patternData.patternMarkup;

    count = 1;
    patternData.annotations = [];
    delete patternData['patternMarkup'];

    for (i = 0; i < comments.comments.length; ++i) {

      item = comments.comments[i];
      els  = markup.querySelectorAll(item.el);

      if (els.length > 0) {
        annotation = { 'displayNumber': count, 'el': item.el, 'title': item.title, 'comment': item.comment };
        patternData.annotations.push(annotation);
        count++;
      }

    }

    // alert the pattern that annotations should be highlighted
    if (patternData.annotations.length > 0) {
      var obj = JSON.stringify({ 'event': 'patternLab.annotationsHighlightShow', 'annotations': patternData.annotations });
      document.getElementById('sg-viewport').contentWindow.postMessage(obj, panelsViewer.targetOrigin);
    }

    // add hasComma property to lineage
    if (patternData.lineage.length > 0) {
      for (i = 0; i < patternData.lineage.length; ++i) {
        if (i < (patternData.lineage.length - 1)) {
          patternData.lineage[i].hasComma = true;
        }
      }
    }

    // add hasComma property to lineageR
    if (patternData.lineageR.length > 0) {
      for (i = 0; i < patternData.lineageR.length; ++i) {
        if (i < (patternData.lineageR.length - 1)) {
          patternData.lineageR[i].hasComma = true;
        }
      }
    }

    // add *Exists attributes for Hogan templates
    // figure out if the description exists
    patternData.patternDescExists = ((patternData.patternDesc.length > 0) || ((patternData.patternDescAdditions !== undefined) && (patternData.patternDescAdditions.length > 0)));

    // figure out if lineage should be drawn
    patternData.lineageExists = (patternData.lineage.length !== 0);

    // figure out if reverse lineage should be drawn
    patternData.lineageRExists = (patternData.lineageR.length !== 0);

    // figure out if pattern state should be drawn
    patternData.patternStateExists = (patternData.patternState.length > 0);
    
    // figure if annotations should be drawn
    patternData.annotationExists = (patternData.annotations.length > 0);
    
    // figure if the entire desc block should be drawn
    patternData.descBlockExists = (patternData.patternDescExists || patternData.lineageExists || patternData.lineageRExists || patternData.patternStateExists || patternData.annotationExists);
    
    // set isPatternView based on if we have to pass it back to the styleguide level
    patternData.isPatternView = (iframePassback === false);

    // render all of the panels in the base panel template
    template         = document.getElementById('pl-panel-template-base');
    templateCompiled = Hogan.compile(template.innerHTML);
    templateRendered = templateCompiled.render(patternData);

    // make sure templateRendered is modified to be an HTML element
    div              = document.createElement('div');
    div.className    = 'sg-modal-content-inner';
    div.innerHTML    = templateRendered;
    templateRendered = div;

    // add click events
    templateRendered = panelsUtil.addClickEvents(templateRendered, patternPartial);

    // add onclick events to the tabs in the rendered content
    for (i = 0; i < panels.length; ++i) {

      panel = panels[i];

      // default IDs
      panelTab   = '#sg-'+patternPartial+'-'+panel.id+'-tab';
      panelBlock = '#sg-'+patternPartial+'-'+panel.id+'-panel';

      // show default options
      if ((templateRendered.querySelector(panelTab) !== null) && (panel.default)) {
        templateRendered.querySelector(panelTab).classList.add('sg-tab-title-active');
        templateRendered.querySelector(panelBlock).style.display = 'block';
      }

    }

    // find lineage links in the rendered content and add postmessage handlers in case it's in the modal
    $('#sg-code-lineage-fill a, #sg-code-lineager-fill a', templateRendered).on('click', function(e){
      e.preventDefault();
      var obj = JSON.stringify({ 'event': 'patternLab.updatePath', 'path': urlHandler.getFileName($(this).attr('data-patternpartial')) });
      document.getElementById('sg-viewport').contentWindow.postMessage(obj, panelsViewer.targetOrigin);
    });

    // gather panels from plugins
    Dispatcher.trigger('insertPanels', [templateRendered, patternPartial, iframePassback, switchText]);

  }
1358970
def add_regex_start_end(pattern_function):
    """"""

    @wraps(pattern_function)
    def func_wrapper(*args, **kwargs):
        return r'^{}$'.format(pattern_function(*args, **kwargs))
    return func_wrapper
409250
function walker(context, pattern) {
  var args = Array.prototype.splice.call(arguments, 0);

  if (isUndefined(context)) {
    throw {
      name: 'Error',
      message: 'Expected context to be defined',
      arguments: args
    };
  } else if (!isObject(context)) {
    throw {
      name: 'Error',
      message: 'Expected context to be an object, but got something else',
      arguments: args
    };
  }

  if (isUndefined(pattern)) {
    throw {
      name: 'Error',
      message: 'Expected pattern to be defined',
      arguments: args
    };
  } else if (!isNumber(pattern) && !isString(pattern)) {
    throw {
      name: 'Error',
      message: 'Expected pattern to be a number or a string, but got ' +
        'something else',
      arguments: args
    };
  }

  var current;
  if (isNumber(pattern)) {
    current = pattern;
  } else {
    var aborting = false;
    var parts = pattern.split('.');
    while (aborting === false && parts.length) {
      var head = parts.shift();
      current = context[head];
      if (!isUndefined(current)) {
        context = current;
      } else {
        current = undefined;
        aborting = true;
      }
    }
  }
  return current;
}
319177
function endshere(subword) {
		var nextindex = charindex + 1;
		return input.length === nextindex ||
			!input[nextindex].match(METHODNAME);
	}
1149971
public void setContextCenter(Pattern pattern) {
	// build up the classgraph printing the relations for all of the
	// classes that make up the "center" of this context
	this.pattern = pattern;
	matched = new ArrayList<ClassDoc>();
	for (ClassDoc cd : root.classes()) {
	    if (pattern.matcher(cd.toString()).matches()) {
		matched.add(cd);
		addToGraph(cd);
	    }
	}
    }
58268
function (pattern, options) {
    options = options || {};
    this.pattern = new Pattern(pattern, options);
    this.recurse = this.shouldRecurse(this.pattern, options);

    // if middleware are registered, use the glob, otherwise regex
    var glob = this.fns.length
      ? this.pattern.glob
      : this.pattern.regex;

    this.defaults(glob, options);
    this.include(glob, options);
    return this;
  }
125040
async function isInPattern(filePath, pattern, options, callback) {
  if (!pattern) {
    callback(null, false);
  } else {
    options = options || {};
    // var result = false;
    var isDirectory = await exports.isDirectory(filePath);
    if (isDirectory) {
      options.includeFolders = true;
    }
    if (!Array.isArray(pattern)) {
      var inPattern = await isInPatternSingle(filePath, pattern, options);
      callback(null, inPattern);
    } else {
      var isIn = false;
      for (const patt of pattern) {
        var inPattern = await isInPatternSingle(filePath, patt, options);
        if (inPattern) {
          isIn = true;
        }
      }
      callback(null, isIn);
    }
  }
}
1316751
private String matchPatternInBuffer(Pattern pattern) {
        matchValid = false;
        matcher.usePattern(pattern);
        matcher.region(position, buf.limit());
        if (matcher.lookingAt()) {
            if (matcher.hitEnd() && (!sourceClosed)) {
                // Get more input and try again
                needInput = true;
                return null;
            }
            position = matcher.end();
            return matcher.group();
        }

        if (sourceClosed)
            return null;

        // Read more to find pattern
        needInput = true;
        return null;
    }