druidG.g:441:1: regexFilter returns [Filter filter] : (a= ID WS LIKE WS b= ( SINGLE_QUOTE_STRING ) ) ;
540578
public final Filter regexFilter() throws RecognitionException {
		Filter filter = null;


		Token a=null;
		Token b=null;

		filter = new Filter("regex");
		try {
			// druidG.g:443:2: ( (a= ID WS LIKE WS b= ( SINGLE_QUOTE_STRING ) ) )
			// druidG.g:443:4: (a= ID WS LIKE WS b= ( SINGLE_QUOTE_STRING ) )
			{
			// druidG.g:443:4: (a= ID WS LIKE WS b= ( SINGLE_QUOTE_STRING ) )
			// druidG.g:443:5: a= ID WS LIKE WS b= ( SINGLE_QUOTE_STRING )
			{
			a=(Token)match(input,ID,FOLLOW_ID_in_regexFilter3002); 
			match(input,WS,FOLLOW_WS_in_regexFilter3004); 
			match(input,LIKE,FOLLOW_LIKE_in_regexFilter3006); 
			match(input,WS,FOLLOW_WS_in_regexFilter3008); 
			// druidG.g:443:24: ( SINGLE_QUOTE_STRING )
			// druidG.g:443:25: SINGLE_QUOTE_STRING
			{
			b=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_regexFilter3014); 
			}

			}

			filter.dimension = (a!=null?a.getText():null);
					 filter.pattern = unquote((b!=null?b.getText():null));
					
			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
		}
		return filter;
	}
1267796
def unquote_pre_filter(pre_filter, _regex=re.compile(r'[\\]+')):
    
    if pre_filter.startswith('"') and pre_filter.endswith('"'):
        # Unquote outer level
        pre_filter = pre_filter[1:-1]
        pre_filter = _regex.sub(lambda x: x.group(0)[:len(x.group(0)) // 2], pre_filter)

    return pre_filter
387591
function parseExpression(str) {

  var expMatches = str.match(expressionRegex)

  // get the args from the second match
  // extract options from args using filter with side effect
  var options = {}
  var args = compact((expMatches[2] || '').split(argsRegex))
    .filter(function (arg) {
      var keyValue = arg.split('=')
      return keyValue.length === 1 || (options[keyValue[0]] = keyValue[1], false)
    })

  return {
    expression: expMatches[1] || null,
    args: args,
    options: options
  }
}
188015
def make_filter_string(cls, filter_specification):
        
        registry = get_current_registry()
        visitor_cls = registry.getUtility(IFilterSpecificationVisitor,
                                          name=EXPRESSION_KINDS.CQL)
        visitor = visitor_cls()
        filter_specification.accept(visitor)
        return str(visitor.expression)
659203
def filter_service_by_regex_name(regex):
    
    host_re = re.compile(regex)

    def inner_filter(items):
        """Inner filter for service. Accept if regex match service_description"""
        service = items["service"]
        if service is None:
            return False
        return host_re.match(service.service_description) is not None

    return inner_filter
1152089
def regexp_filter(self_or_cls, pattern):
        
        def inner_filter(name, p):
            name_match = re.search(pattern,name)
            if name_match is not None:
                return True
            doc_match = re.search(pattern,p.doc)
            if doc_match is not None:
                return True
            return False
        return inner_filter
1045760
function filtered(js) {
  return js.substr(1).split('|').reduce(function(js, filter){
    var parts = filter.split(':')
      , name = parts.shift()
      , args = parts.shift() || '';
    if (args) args = ', ' + args;
    return 'filters.' + name + '(' + js + args + ')';
  });
}
1051356
def parse_filtering_param(filtering_param, allowed_params)
      return {} unless filtering_param.present?

      fields = {}

      # Extract the fields for each type from the fields parameters
      if filtering_param.is_a?(Hash)
        filtering_param.each do |field, value|
          resource_fields = value.split(',') unless value.nil? || value.empty?
          fields[field.to_sym] = resource_fields
        end
      else
        raise InvalidFilterException, "Invalid filter format for #{filtering_param}"
      end
      check_filtering_param(fields, allowed_params)
      fields
    end
409640
private AbsFilter parseWildcard(final boolean mIsAtt) {

        AbsFilter filter;
        boolean isName = false;

        if (is(TokenType.STAR, true)) {

            if (is(TokenType.COLON, true)) {
                isName = true; // < "*" ":" NCName > .
            } else {

                return mIsAtt // "*"
                    ? new AttributeFilter(getTransaction()) : new ElementFilter(getTransaction());

            }
        }

        filter = new WildcardFilter(getTransaction(), parseNCName(), isName);
        if (!isName) { // < NCName ":" "*" >
            consume(TokenType.COLON, true);
            consume(TokenType.STAR, true);
        }
        return filter;
    }
145510
def filter(self, value=None, exclude=False, **selection):
        
        filters = self.meta.setdefault('filters', [])

        if value and len(selection):
            raise ValueError("Cannot specify a filter string and a filter keyword selection at the same time.")
        elif value:
            value = [value]
        elif len(selection):
            value = select(self.api.columns, selection, invert=exclude)

        filters.append(value)
        self.raw['filters'] = utils.paste(filters, ',', ';')
        return self
624379
function getHbsCompatibleFilter (filterName) {
    var specialReturnValue = filterName === 'yavu' ? '\uFFFD' : '';
    return function filter (s) {
        // align with Handlebars preference to return '' when s is null/undefined, except in unquoted attr, '\uFFFD' is returned to avoid context breaking
        return s === null || s === undefined ? specialReturnValue : 
            // Unlike escapeExpression(), return s instead of s.toHTML() since downstream
            //  filters of the same chain has to be disabled too.
            //  Handlebars will invoke SafeString.toString() at last during data binding
            s.toHTML ? s : xssFilters._privFilters[filterName](s);
    };
}
449719
def add_filter_by_regex(self, regex_expression, filter_type=DefaultFilterType):
        
        self.add_filter(FilterRegex(regex_expression), filter_type)
        return self
170835
def filter_string(filter = {}, array_join = nil)
      filter.inject('') do |mem, kv|
        key, value = kv
        if value.is_a?(Array)
          if !array_join.nil?
            mem += value.inject('') { |m, v|
              v = "\"#{v}\"" if v.to_s.include?(' ')
              m+= "#{key}:#{v}"
            }
            return mem
          else
            value = value.join(array_join)
          end
        end
        value = "\"#{value}\"" if value.to_s.include?(' ')
        mem += "#{key}:#{value} "
      end
    end
49634
function computeFilterFn(filter) {
     if (filter) {
        if (typeof filter === 'string') {
           var regex = new RegExp(filter);
           return function(filePath) { return regex.test(filePath); }
        }
        else if (filter instanceof RegExp)
           return function(filePath) { return filter.test(filePath); }
        else   // must be a function itself
           return filter;
      }
      else  // none, return "pass all"
         return function() { return true; };
   }
954799
function(filter) {
      return u(array.filter.call(this, function(el, index) {
        return /^f/.test(typeof filter) ? filter(index, el) : u(el).is(filter);
      }));
    }
875008
def text_filter(regex_base, value):
    
    regex = regex_base % {
        're_cap': r'[a-zA-Z0-9\.\,:;/_ \(\)\-\!\?"]+',
        're_img': r'[a-zA-Z0-9\.:/_\-\% ]+'
    }
    images = re.findall(regex, value)

    for i in images:
        image = i[1]
        if image.startswith(settings.MEDIA_URL):
            image = image[len(settings.MEDIA_URL):]

        im = get_thumbnail(image, str(sorl_settings.THUMBNAIL_FILTER_WIDTH))
        value = value.replace(i[1], im.url)

    return value
108246
function addFilter (config, filter) {
  if (filter) {
    if (filter[ 0 ] === '-') {
      config.filters.ignore[ filter ] = new RegExp('^' + filter.slice(1).replace(/[*]/g, '.*?') + '$')
    } else {
      config.filters.should[ filter ] = new RegExp('^' + filter.replace(/[*]/g, '.*?') + '$')
    }
  }
}