This method read a single parameter and build the regular expression
975846
private function param($key, $string, $value) {

        $field_required = false;

        // If the field name ends with a '*', the parameter is considered as required
        if (preg_match('/^(.+)\*$/', $key, $bits)) {

            $key = $bits[1];
            $field_required = true;

        }

        // The $value query object contains all regex which will be used by the collector to parse the route fields
        $value->setQuery($key, $string, $field_required);

        /* Every parameter can include it's own logic into the regular expression,
         * it can use backreferences and it's expected to be used against a single parameter.
         * This means that it can't be used as is to build the route regular expression,
         * Backreferences are not useful at this point and can make the regular expression more time consuming
         * and resource hungry. This is why they are replaced with the grouping parenthesis.
         * Eg: (value) changes in (?:value)
         *
         * Delimiting characters like '^' and '$' are also meaningless in the complete regular expression and
         * need to be removed. Contrariwise, wildcards must be delimited in order to keep the whole regular
         * expression consistent, hence a '?' is added to all the '.*' or '.+' that don't already have one.
         */
        $string = preg_replace("/(?<!\\\\)\\((?!\\?)/", '(?:', $string);
        $string = preg_replace("/\\.([\\*\\+])(?!\\?)/", '.${1}?', $string);
        $string = preg_replace("/^[\\^]/", '', $string);
        $string = preg_replace("/[\\$]$/", '', $string);

        /* The produced regular expression is grouped and associated with its key (this means that the 'preg_match'
         * function will generate an associative array where the key/value association is preserved).
         * If the field is required, the regular expression is completed with a '{1}' (which make it compulsory),
         * otherwise a '?' is added.
         */
        return '(?P<'.$key.'>'.$string.')'.(($field_required) ? '{1}' : '?');

    }
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
798891
function extractParameters( &$text, $offSet, &$parameters, $skipFirstChar=false )
    {
        $endOffset = strpos( $text, '>', $offSet );
        if ( $endOffset === false )
        {
            $endOffset = strlen( $text );
        }

        if ( $skipFirstChar === false )
            $offSet++;
        while ( $offSet < $endOffset )
        {
            $nameEnd = strpos( $text, ':', $offSet );
            $valueEnd = strpos( $text, ':', $nameEnd+1 );
            if ( $valueEnd > $endOffset || $valueEnd === false )
            {
                $valueEnd = $endOffset;
            }
            $paramName = substr( $text, $offSet, $nameEnd-$offSet);
            ++$nameEnd;
            $paramValue = substr( $text, $nameEnd, $valueEnd-$nameEnd );
            $parameters[$paramName] = $paramValue;
            $offSet = ++$valueEnd;
        }

        return $endOffset;
    }
487156
protected Param getParam (ParamReader reader, String name) {
        return getParam(new Param(reader, name));
    }
265450
private String[] readParamValues() throws BuildException {
        final ArrayList<String> prop = new ArrayList<>();
        for (final ParamElem p : params) {
            if (!p.isValid()) {
                throw new BuildException("Incomplete parameter");
            }
            if (isValid(getProject(), getLocation(), p.getIf(), p.getUnless())) {
                final int idx = Integer.parseInt(p.getName()) - 1;
                if (idx >= prop.size()) {
                    prop.ensureCapacity(idx + 1);
                    while (prop.size() < idx + 1) {
                        prop.add(null);
                    }
                }
                prop.set(idx, p.getValue());
            }
        }
        return prop.toArray(new String[0]);
    }
877433
public boolean parse(Context context, ProcPatternElement terminator) {
        Source source = context.getSource();
        int offset = source.getOffset();

        int end;
        if (terminator != null && !ghost) {
            end = terminator.findIn(source);
            if (end < 0) {
                if (regex == null) {
                    return false;
                } else {
                    end = source.length();
                }
            }
        } else {
            end = source.length();
        }


        CharSequence value = source.sub(end);

        // If define regex, then find this regex in value
        if (regex != null) {
            Matcher matcher = regex.matcher(value);
            if (matcher.lookingAt()) {
                int lend = matcher.end();
                end = offset + lend;
                value = matcher.group();
            } else {
                return false;
            }
        }

        // Old context value
        CharSequence old = (CharSequence) context.getAttribute(getName());

        // Test this variable already defined and equals with this in this code scope
        CharSequence attr = (CharSequence) context.getLocalAttribute(getName());
        if (attr == null || attr.equals(value)) {
            if (attr == null) {
                if (action == Action.rewrite) {
                    setAttribute(context, value);
                } else {
                    /* action == append */
                    if (old != null) {
                        setAttribute(context, new StringBuilder().append(old).append(value));
                    } else {
                        setAttribute(context, value);
                    }
                }
            }
            if (!ghost) {
                source.incOffset(end - offset);
            }
            return true;
        } else {
            return false;
        }
    }
839592
public <T extends Parameters> T read(T parameters) throws AponParseException {
        if (parameters == null) {
            throw new IllegalArgumentException("parameters must not be null");
        }
        addable = parameters.isAddable();
        try {
            valuelize(parameters, NO_CONTROL_CHAR, null, null, null, false);
        } catch (AponParseException e) {
            throw e;
        } catch (Exception e) {
            throw new AponParseException("Could not read an APON formatted document into a Parameters object", e);
        }
        return parameters;
    }
1082665
function _parseParameters(rule, parameter) {
    if (rule.toLowerCase() == 'regex') return [parameter];
    if (is_string(parameter)) {
      return parameter.split(',');
    };

    return [];
  }
687403
def process_path_part(part, parameters):
    
    if PARAMETER_REGEX.match(part):
        parameter_name = part.strip('{}')
        try:
            parameter = find_parameter(
                parameters,
                name=parameter_name,
                in_=PATH
            )
        except ValueError:
            pass
        else:
            return construct_parameter_pattern(parameter)
    return escape_regex_special_chars(part)
550044
function(matches, index, tokens, regexValue) {
      var i = tokens.length;

      while (--i >= 0) {
        var token = tokens[i];
        var type = token.type;

        if (type === _Comment ||
            type === _WhiteSpace ||
            type === _LineTerminator) {
          continue;
        }

        var value = token.value;
        if (type === _Punctuator) {
          if (value === ')') {
            if (this.isValidRegExpPrefix(tokens, i + 1)) {
              break;
            }
          } else if (regexPrefixRe.test(value)) {
            break;
          }
        } else if ((type === _Keyword && regexPrefixRe.test(value)) ||
                   (type === _Template && value.slice(-2) === '${')) {
          break;
        }

        var parts = regexValue.match(tokenizeNotRegExpRe);
        splice.apply(matches, [index, 1].concat(parts));
        return true;
      }
      return false;
    }
723710
private String getParameterString(Entry<String, String> parameter) {

        return parameter.getKey() + "=" + parameter.getValue();
    }
1252715
public static String lookupParameterValue(String key, String string) {
		Pattern p = Pattern.compile("\\[" + key + "=[^\\]]*\\]");
		Matcher m = p.matcher(string);
		m.find();
    	String f = m.group();
    	int p1 = f.indexOf('=');
    	int p2 = f.indexOf(']');
    	return f.substring(p1+1, p2);
	}
636925
function getParameterDescriptor (parameter) {
  var parts = parameter.split(SLASHED_BRACKETS_REG_EXP);

  return {
    name: parts[0].trim().substring(1)
  };
}
682143
static private String findParamFor(String s)
	{
		int endClassIndex = s.indexOf('[');
		if (endClassIndex<0) return null;
		else {
			int endParamIndex = s.indexOf('=',endClassIndex+1);
			if (endParamIndex<0) throw new IllegalStateException("illegal class description '"+s+"'");
			return s.substring(endClassIndex+1,endParamIndex);
		}
	}
1064377
private void parse()
   {
      template = text;
      if (StringUtils.isEmptyTrimmed(template))
         return;
      int index = 0;
      while (template.indexOf("${") != -1)
      {
         int from = template.lastIndexOf("${");
         int to = template.indexOf("}", from + 2);
         if (to == -1)
         {
            template = text;
            complex = false;
            entities.clear();
            return;
         }

         int dv = template.indexOf(":", from + 2);
         if (dv != -1 && dv > to)
         {
            dv = -1;
         }
         String systemProperty = null;
         String defaultValue = null;
         String s = template.substring(from + 2, to);
         if ("/".equals(s))
         {
            systemProperty = File.separator;
         }
         else if (":".equals(s))
         {
            systemProperty = File.pathSeparator;
            dv = -1;
         }
         else
         {
            systemProperty = SecurityActions.getSystemProperty(s);
         }

         if (dv != -1)
         {
            s = template.substring(from + 2, dv);
            systemProperty = SecurityActions.getSystemProperty(s);
            defaultValue = template.substring(dv + 1, to);
         }
         String prefix = "";
         String postfix = "";
         String key = StringUtils.createKey(index++);
         updateComplex(defaultValue);
         entities.put(key, new Expression(s, defaultValue, systemProperty));

         if (from != 0)
         {
            prefix = template.substring(0, from);
         }
         if (to + 1 < template.length())
         {
            postfix = template.substring(to + 1);
         }
         template = prefix + key + postfix;
      }
      updateComplex(template);
   }
1227977
function _formatAtRuleParams(value) {
	if (/^"(.*)"$/.test(value) || /^'(.*)'$/.test(value)) {
		return value.slice(1, value.length - 1);
	}
	return value;
}
947064
private static Object readParam(DataInput reader) throws IOException {
		int type = reader.readUnsignedByte();
		switch (type) {
		case BYTE_ID:
			return Byte.valueOf(reader.readByte());
		case SHORT_ID:
			return Short.valueOf(reader.readShort());
		case INTEGER_ID:
			return Integer.valueOf(reader.readInt());
		case CHAR_ID:
			return Character.valueOf(reader.readChar());
		case LONG_ID:
			return Long.valueOf(reader.readLong());
		case FLOAT_ID:
			return Float.valueOf(reader.readFloat());
		case DOUBLE_ID:
			return Double.valueOf(reader.readDouble());
		case DATE_ID:
			return new Date(reader.readLong());
		case STRING_ID:
			return readString(reader);
		case NULL_ID:
			return null;
		}
		throw new DeserializerException("Wrong type of a parameter", "one of the B,S,I,C,L,F,D,T,O,N", Character.toString((char)type));
	}