src/riemann/Query.g:55:1: regex_match : field ( WS )* REGEX_MATCH ( WS )* value ;
430356
public final QueryParser.regex_match_return regex_match() throws RecognitionException {
        QueryParser.regex_match_return retval = new QueryParser.regex_match_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token WS41=null;
        Token REGEX_MATCH42=null;
        Token WS43=null;
        QueryParser.field_return field40 = null;

        QueryParser.value_return value44 = null;


        CommonTree WS41_tree=null;
        CommonTree REGEX_MATCH42_tree=null;
        CommonTree WS43_tree=null;

        try {
            // src/riemann/Query.g:56:2: ( field ( WS )* REGEX_MATCH ( WS )* value )
            // src/riemann/Query.g:56:4: field ( WS )* REGEX_MATCH ( WS )* value
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_field_in_regex_match376);
            field40=field();

            state._fsp--;

            adaptor.addChild(root_0, field40.getTree());
            // src/riemann/Query.g:56:10: ( WS )*
            loop15:
            do {
                int alt15=2;
                int LA15_0 = input.LA(1);

                if ( (LA15_0==WS) ) {
                    alt15=1;
                }


                switch (alt15) {
            	case 1 :
            	    // src/riemann/Query.g:56:10: WS
            	    {
            	    WS41=(Token)match(input,WS,FOLLOW_WS_in_regex_match378); 
            	    WS41_tree = (CommonTree)adaptor.create(WS41);
            	    adaptor.addChild(root_0, WS41_tree);


            	    }
            	    break;

            	default :
            	    break loop15;
                }
            } while (true);

            REGEX_MATCH42=(Token)match(input,REGEX_MATCH,FOLLOW_REGEX_MATCH_in_regex_match381); 
            REGEX_MATCH42_tree = (CommonTree)adaptor.create(REGEX_MATCH42);
            root_0 = (CommonTree)adaptor.becomeRoot(REGEX_MATCH42_tree, root_0);

            // src/riemann/Query.g:56:27: ( WS )*
            loop16:
            do {
                int alt16=2;
                int LA16_0 = input.LA(1);

                if ( (LA16_0==WS) ) {
                    alt16=1;
                }


                switch (alt16) {
            	case 1 :
            	    // src/riemann/Query.g:56:27: WS
            	    {
            	    WS43=(Token)match(input,WS,FOLLOW_WS_in_regex_match384); 
            	    WS43_tree = (CommonTree)adaptor.create(WS43);
            	    adaptor.addChild(root_0, WS43_tree);


            	    }
            	    break;

            	default :
            	    break loop16;
                }
            } while (true);

            pushFollow(FOLLOW_value_in_regex_match387);
            value44=value();

            state._fsp--;

            adaptor.addChild(root_0, value44.getTree());

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
833689
public static boolean valueMatchesRegularExpression(String val, Pattern regexp) {
		Matcher m = regexp.matcher(val);

		try {
			return m.matches();
		} catch (StackOverflowError e) {
			e.printStackTrace();
			System.out.println("-> [" + val + "][" + regexp + "]");
			System.out.println("-> " + val.length());
			System.exit(0);
		}
		return false;
	}
51292
def match_regex(pattern: str, message=None, *, flags=0,
                fullmatch: bool = False) -> Filter_T:
    

    pattern = re.compile(pattern, flags)

    def validate(value):
        if fullmatch:
            if not re.fullmatch(pattern, value):
                _raise_failure(message)
        else:
            if not re.match(pattern, value):
                _raise_failure(message)
        return value

    return validate
1071118
function(value, field) {
            if(field.parser) {
                var parser = (isFunction(field.parser)) ?
                    field.parser : null;//Y.Parsers[field.parser+''];
                if(parser) {
                    value = parser.call(this, value);
                }
                else {
                    //Y.log("Could not find parser for field " + Y.dump(field), "warn", "dataschema-json");
                }
            }
            return value;
        }
1094270
public final void mWS() throws RecognitionException {
        try {
            int _type = WS;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // BELScript.g:301:4: ( ( ' ' | '\\t' | '\\n' | '\\r' | '\\f' | '\\\\\\n' | '\\\\\\r\\n' )+ )
            // BELScript.g:301:6: ( ' ' | '\\t' | '\\n' | '\\r' | '\\f' | '\\\\\\n' | '\\\\\\r\\n' )+
            {
            // BELScript.g:301:6: ( ' ' | '\\t' | '\\n' | '\\r' | '\\f' | '\\\\\\n' | '\\\\\\r\\n' )+
            int cnt12=0;
            loop12:
            do {
                int alt12=8;
                alt12 = dfa12.predict(input);
                switch (alt12) {
            	case 1 :
            	    // BELScript.g:301:7: ' '
            	    {
            	    match(' '); 

            	    }
            	    break;
            	case 2 :
            	    // BELScript.g:301:13: '\\t'
            	    {
            	    match('\t'); 

            	    }
            	    break;
            	case 3 :
            	    // BELScript.g:301:20: '\\n'
            	    {
            	    match('\n'); 

            	    }
            	    break;
            	case 4 :
            	    // BELScript.g:301:27: '\\r'
            	    {
            	    match('\r'); 

            	    }
            	    break;
            	case 5 :
            	    // BELScript.g:301:33: '\\f'
            	    {
            	    match('\f'); 

            	    }
            	    break;
            	case 6 :
            	    // BELScript.g:301:40: '\\\\\\n'
            	    {
            	    match("\\\n"); 


            	    }
            	    break;
            	case 7 :
            	    // BELScript.g:301:49: '\\\\\\r\\n'
            	    {
            	    match("\\\r\n"); 


            	    }
            	    break;

            	default :
            	    if ( cnt12 >= 1 ) break loop12;
                        EarlyExitException eee =
                            new EarlyExitException(12, input);
                        throw eee;
                }
                cnt12++;
            } while (true);

            _channel = HIDDEN;

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
372870
def match(self, path):
        ''''''
        match = self._regex.search(path)
        if match is not None:
            remaining = path[match.end():]
            groups = match.groupdict()
            result = {}
            for name, value in groups.items():
                try:
                    value = self._converters[name].to_python(value)
                except Http404:
                    return
                result[str(name)] = value
            if remaining:
                result['__remaining__'] = remaining
            return result
1286330
def get_value_matched_by_regex(field_name, regex_matches, string):
    """"""
    try:
        value = regex_matches.group(field_name)
        if value is not None:
            return value
    except IndexError:
        pass

    raise MissingFieldError(string, field_name)
810740
function parseQuery(str, opts = {}) {
  let _querys = {};
  decodeURIComponent(str || '').replace(/\+/g, ' ')
  // (optional no-capturing & )(key)=(value)
  .replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, _name, _value) {
    if (_name) {
      let _path, _acc, _tmp, _ref;
      (_path = []).unshift(_name = _name.replace(/\[([^\]]*)]/g, function ($0, _k) {
        _path.push(_k);
        return '';
      }));
      _ref = _querys;
      for (let j = 0; j < _path.length - 1; j++) {
        _acc = _path[j];
        _tmp = _path[j + 1];
        if (!_ref[_acc]) {
          _ref[_acc] = _tmp === '' || /^[0-9]+$/.test(_tmp) ? [] : {};
        }
        _ref = _ref[_acc];
      }
      if (opts.boolval) {
        // first
        if (_value === 'true') {
          _value = true;
        } else if (_value === 'false') {
          _value = false;
        }
      } else if (opts.intval) {
        // skip "true" & "false"
        if (_tmp = parseInt(_value) === _value) {
          _value = _tmp;
        }
      }
      if ((_acc = _path[_path.length - 1]) === '') {
        _ref.push(_value);
      } else {
        _ref[_acc] = _value;
      }
    }
  });
  return _querys;
}
836599
public final void mWS() throws RecognitionException {
		try {
			int _type = WS;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// hql.g:791:5: ( ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' ) )
			// hql.g:791:9: ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' )
			{
			// hql.g:791:9: ( ' ' | '\\t' | '\\r' '\\n' | '\\n' | '\\r' )
			int alt4=5;
			switch ( input.LA(1) ) {
			case ' ':
				{
				alt4=1;
				}
				break;
			case '\t':
				{
				alt4=2;
				}
				break;
			case '\r':
				{
				int LA4_3 = input.LA(2);
				if ( (LA4_3=='\n') ) {
					alt4=3;
				}

				else {
					alt4=5;
				}

				}
				break;
			case '\n':
				{
				alt4=4;
				}
				break;
			default:
				if (state.backtracking>0) {state.failed=true; return;}
				NoViableAltException nvae =
					new NoViableAltException("", 4, 0, input);
				throw nvae;
			}
			switch (alt4) {
				case 1 :
					// hql.g:791:13: ' '
					{
					match(' '); if (state.failed) return;
					}
					break;
				case 2 :
					// hql.g:792:7: '\\t'
					{
					match('\t'); if (state.failed) return;
					}
					break;
				case 3 :
					// hql.g:793:7: '\\r' '\\n'
					{
					match('\r'); if (state.failed) return;
					match('\n'); if (state.failed) return;
					}
					break;
				case 4 :
					// hql.g:794:7: '\\n'
					{
					match('\n'); if (state.failed) return;
					}
					break;
				case 5 :
					// hql.g:795:7: '\\r'
					{
					match('\r'); if (state.failed) return;
					}
					break;

			}

			if ( state.backtracking==0 ) {skip();}
			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
315471
function parseStoredType(value /* , context */) {
    const regex = /^(\w+)(\((.*?)\))?$/;
    const result = value.match(regex);
    if (!result) throw new ImplementationError(`Invalid storedType "${value}"`);

    const type = result[1];
    const options = {};
    if (result[2]) {
        const regexOptions = /^(\w+)=(.*)/;
        result[3].split(';').forEach(o => {
            const resultOptions = o.match(regexOptions);
            if (!resultOptions) throw new ImplementationError(`Invalid storedType "${value}"`);
            options[resultOptions[1]] = resultOptions[2];
        });
    }

    return { type, options };
}
870570
function read (value) {
    if (value instanceof RegExp) {
      var chars = source.slice(index)
      var match = chars.match(value)
      if (match) {
        index += match[0].length
        return match[0]
      }
    } else {
      if (source.indexOf(value, index) === index) {
        index += value.length
        return value
      }
    }
  }
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))
880827
def validate_regex(ctx, param, value):
    
    if not value:
        return None

    try:
        re.compile(value)
    except re.error:
        raise click.BadParameter('Invalid regex "{0}" provided'.format(value))

    return value
701671
function _match (rule, cmtData) {
        var path = rule.subject.split('.');
        var extracted = cmtData;
        while (path.length > 0) {
            var item = path.shift();
            if (item === '') {
                continue;
            }
            if (extracted.hasOwnProperty(item)) {
                extracted = extracted[item];
            }
            if (extracted === null || typeof extracted === 'undefined') {
                extracted = null;
                break;
            }
        }
        if (extracted === null) {
            // Null precondition implies anything
            return true;
        }
        switch (rule.op) {
            case '<':
                return extracted < rule.value;
            case '>':
                return extracted > rule.value;
            case '~':
            case 'regexp':
                return (new RegExp(rule.value)).test(extracted.toString());
            case '=':
            case 'eq':
                return rule.value ===
                    ((typeof extracted === 'number') ?
                        extracted : extracted.toString());
            case '!':
            case 'not':
                return !_match(rule.value, extracted);
            case '&&':
            case 'and':
                if (Array.isArray(rule.value)) {
                    return rule.value.every(function (r) {
                        return _match(r, extracted);
                    });
                } else {
                    return false;
                }
            case '||':
            case 'or':
                if (Array.isArray(rule.value)) {
                    return rule.value.some(function (r) {
                        return _match(r, extracted);
                    });
                } else {
                    return false;
                }
            default:
                return false;
        }
    }
93792
def _regexp(expr, item):
    ''' 
    '''
    reg = re.compile(expr)
    return reg.search(item) is not None
568643
public static boolean validateRequiredField(String field, String reg) {
        return !(field == null || field.isEmpty()) && Pattern.matches(reg, field);
    }
1253733
private static Bson prefixQuery(String fieldName, String prefix){
        return Filters.regex(fieldName, "^" + RegexEscape.escape(prefix) + ".*");
    }