Returns a query expression to be used in match stages
421360
public function matchExpr() : QueryExpr
    {
        $expr = new QueryExpr($this->dm);
        $expr->setClassMetadata($this->class);

        return $expr;
    }
354766
function(query) {
        var queryObj = {q: ''};
        if(!query) {
            return queryObj;
        }

        var qArray = query.split('&');
        var qObj = qs.parse(query);
        for(var i = 0, len = qArray.length; i < len; i++) {
            var queryItem = decodeURIComponent(qArray[i]).replace('=', '');
            if(/^\?/g.test(queryItem)) {
                debug('matched query: %s', queryItem) ;
                queryObj.q = queryItem;
                break;
            }
        }

        queryObj.m = qObj._mcss == 'true' || qObj._mcss == 'y';
        return queryObj;
    }
40283
function match(routes, path) {

  // Get the query object before it gets stripped by the normalizer
  const query = getQuery(path);
  const pathname = path;

  // Normalize the path
  path = normalizePath(path);

  // Loop over each route to find the match
  for (let i = 0; i < routes.length; i++) {

    // Normalize the current route
    const currentRoute = normalizePath(routes[i].route);

    // Create the params object
    const params = {};

    // Check if it's a straight match first
    if(currentRoute === path) {
      return Object.assign({}, routes[i], {params, query, pathname, path});
    }

    // If there are no dynamic/optional/match-all parts then this route cannot match
    if(!isDynamicRoute.test(routes[i].route)) {
      continue;
    }

    // Split up the route by it's slashes so that we may match by section
    const routeSections = currentRoute.split('/');
    const pathSections = path.split('/');

    // Loop over each section looking for a full match
    for (let j = routeSections.length - 1; j >= 0; j--) {

      // If the route is to match everything, then return
      if(j === 0 && routeSections[j] === '*') {
        return Object.assign({}, routes[i], {params, query, pathname, path});
      }

      // If this section is optional
      if(optionalSectionRegex.test(routeSections[j])) {

        const currentSection = routeSections[j].replace(removeOptionalRegex, '');

        // If it's a param, add it to the params
        if(paramRegex.test(currentSection)) {
          params[currentSection.replace(paramRegex, '')] = pathSections[j];
          continue;
        }

        // If it's a star then skip to next
        if(currentSection === '*') {
          continue;
        }

        // If the optional section can possible be missing skip to next section
        if(routeSections.length === pathSections.length + 1) {
          continue;
        }

        // If the path and route sections have same number of sections and this does match, skip to next
        if(routeSections.length === pathSections.length && currentSection === pathSections[j]) {
          continue;
        }

        // Reject this route as the possible match to the path
        break;
      }

      // If it's a param, add it to the params
      if(paramRegex.test(routeSections[j])) {
        params[routeSections[j].replace(paramRegex, '')] = pathSections[j];

        if(j === 0) {
          return Object.assign({}, routes[i], {params, query, pathname, path});
        }

        continue;
      }

      // If it's a star then skip to next
      if(routeSections[j] === '*') {
        continue;
      }

      // If this doesn't match then go to next route
      if(routeSections[j] !== pathSections[j]) {
        break;
      }

      // If the last item matches strictly then return that match
      if(j === 0 && routeSections[j] === pathSections[j]) {
        return Object.assign({}, routes[i], {params, query, pathname, path});
      }
    }
  }

  // No match found
  return {path: '', params: {}, query};
}
248459
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
        """"""
        c = self.copy()
        c.is_summary = summarize
        c.for_save = for_save
        final_points = []
        for i, p in enumerate(self.params):
            try:
                float(p)
            except:
                _, source, _, join_list, last = query.setup_joins(
                        six.text_type(p).split('__'), query.model._meta, query.get_initial_alias())[:5]
                target, alias, _ = query.trim_joins(source, join_list, last)
                final_points.append("%s.%s" % (alias, target[0].get_attname_column()[1]))
            else:
                final_points.append(six.text_type(p))
            c.params = final_points
        return c
1238287
public PactDslRequestWithPath matchQuery(String parameter, String regex) {
        return matchQuery(parameter, regex, new Generex(regex).random());
    }
771077
@SuppressWarnings("unchecked")
	public DomainObjectMatch<T> ELEMENTS(TerminalResult...  where) {
		DomainObjectMatch<T> ret;
		// all where expressions have already been added to the astObjects list
		// of the SelectExpression
		SelectExpression<T> se = this.getSelectExpression();
		
		// create match for the true type
		DomainObjectMatch<?> selDom =APIAccess.createDomainObjectMatch(
					se.getStart().getDomainObjectType(),
				se.getQueryExecutor().getDomainObjectMatches().size(),
				se.getQueryExecutor().getMappingInfo());
		handleUnionExpressions(se);
		se.getQueryExecutor().getDomainObjectMatches().add(selDom);
		se.resetAstObjectsContainer();
		se.setEnd(selDom);
		if (se.isReject()) {
			Boolean br_old = QueryRecorder.blockRecording.get();
			try {
				QueryRecorder.blockRecording.set(Boolean.TRUE);
				// remove it from the return statement
				// it is only temporary
				APIAccess.setPartOfReturn(selDom, false);
				AbstractDomainQuery q = se.getDomainQuery();
				DomainObjectMatch<?> rejectDom = InternalAccess.createMatch(q, se.getStart().getDomainObjectType());
				// build complementary set
				q.WHERE(rejectDom).IN(se.getStart());
				q.WHERE(rejectDom).NOT().IN(selDom);
				selDom = rejectDom;
			} finally {
				QueryRecorder.blockRecording.set(br_old);
			}
		}
		if (se.getStartType().equals(DomainObject.class)) // generic domain object match
			ret = APIAccess.createDomainObjectMatch(se.getStartType(), selDom);
		else
			ret = (DomainObjectMatch<T>) selDom;
		Object[] placeHolders = null;
		if (where != null) {
			placeHolders = new QueryRecorder.PlaceHolder[where.length];
			for (int i = 0; i < where.length; i++) {
				placeHolders[i] = QueryRecorder.placeHolder(where[i]);
			}
		}
		DomainObjectMatch<?> delegate = APIAccess.getDelegate(ret);
		DomainObjectMatch<?> match = delegate != null ? delegate : ret;
		if (placeHolders != null)
			QueryRecorder.recordStackedAssignment(this, "ELEMENTS", match, placeHolders);
		else
			QueryRecorder.recordStackedAssignment(this, "ELEMENTS", match);
		return ret;
	}
577905
def query(self, ns, selector='*'):
    
    q, r = HicaLabelStore.PREFIX + '.' + ns, []
    for (key, value) in self.items:
      if not selector and key == q:
        r.append((key, value))
      if key.startswith(q) and key != q:
        sub = key[len(q):]
        m = re.match('.' + selector, sub)
        if m:
          r.append((key, value))
    return r
380428
function ReactShallowQuery(objects, query) {
    if (typeof query !== "string")
        throw new Error("You must provide a query.");

    if (!Array.isArray(objects))
        objects = [objects];
    
    const fragments = query.split(" ");
    let recursive = true;

    // Loop through each fragments.
    return fragments.reduce((results, fragment, index) => {
        if (fragment == ">") {
            recursive = false;
            
            return results;
        }

        // Parse the fragment to figure out what matcher to use.
        // The matcher is used on each component to figure out if meets the query criteria.
        const matcher = getMatcher(fragment);

        // Alter the accumulative results array based on the current fragment.
        // This may add new elements or remove existing elements within the array.
        return results.reduce((elements, element) => {
            let objects = (index ? element.props.children : element);

            if (!Array.isArray(objects))
                objects = [objects];
            
            // Append the newly found elements.
            return elements.concat(findResults(objects, matcher, fragment, recursive));
        }, []);
    }, objects);
}
888395
def make_query(self, query_type, expression, **kwargs):
        
        data = dict(expression=str(expression),
                    stop=kwargs.get('stop', datetime.utcnow()))
        data.update(kwargs)

        for k in ['start', 'stop']:
            if k in data:
                try:
                    data[k] = data[k].isoformat()
                except AttributeError:
                    pass

        r = requests.get(self.evaluator_url + query_type, params=data)
        r.raise_for_status()

        return r.json()
262177
def match(value, query):
    
    if type(query) in [str, int, float, type(None)]:
        return value == query
    elif type(query) == dict and len(query.keys()) == 1:
        for op in query:
            if op == "$eq": return value == query[op]
            elif op == "$lt": return value < query[op]
            elif op == "$lte": return value <= query[op]
            elif op == "$gt": return value > query[op]
            elif op == "$gte": return value >= query[op]
            elif op == "$ne": return value != query[op]
            elif op == "$in": return value in query[op]
            elif op == "$nin": return value not in query[op]
            else: GeoQLError("Not a valid query operator: " + op)
    else:
        raise GeoQLError("Not a valid query: " + str(query))
520242
public <T> JDOQuery<T> select(Expression<T> expr) {
        return query().select(expr);
    }
970653
def matches_key_in_query(self, key, query_key, query):
        
        dumped = query.dump()
        dumped['className'] = query._query_class._class_name
        self._add_condition(key, '$select', {'key': query_key, 'query': dumped})
        return self
1318709
def get_match(self, elem):
        """"""
        for m in self.matches:
            if (m.expression is not None and eval(m.expression)==True) \
            or (m.xpath is not None and len(elem.xpath(m.xpath, namespaces=m.namespaces)) > 0):
                LOG.debug("=> match: %r" % m.expression)
                return m
1339836
function queryFilter(where) {
  if (where.$or) {
    return object =>
      _.reduce(where.$or, (result, subclause) => result ||
        queryFilter(subclause)(object), false);
  }

  // Go through each key in where clause
  return object => _.reduce(where, (result, whereParams, key) => {
    const match = evaluateObject(object, whereParams, key);
    return result && match;
  }, true);
}
583478
function searchFilter(mock) {
            if (!vm.searchUrl || !mock.expression) {
                return true;
            }

            return vm.searchUrl.match(mock.expression);
        }
1297044
def _match(self, query):
        
        response = self._match_dialog(query)
        if response is not None:
            return response

        response = self._match_getters(query)
        if response is not None:
            return response

        response = self._match_registers(query)
        if response is not None:
            return response

        response = self._match_errors_queues(query)
        if response is not None:
            return response

        response = self._match_setters(query)
        if response is not None:
            return response

        if response is None:
            for channel in self._channels.values():
                response = channel.match(query)
                if response:
                    return response

        return None
870977
function(query) {
    query = query || '';
    
    // TODO optimize with RegExp

    var nameChain = query.split('.');
    for(var i=0; i<nameChain.length; i++) {
      if(!nameChain[i].match(/(\*(\*)?|[a-zA-Z0-9_]+)/)) {
        return false;
      }
    }

    return true;
  }