this method returns the variables defined by the filter. e.g. data-sly-use.variable

@param filter
@param text
@return the variable defined by the filter
344911
private List<String> resolveVariable(String filter, String text) {
    List<String> ret = new ArrayList<>();
    Matcher m = PATTERN.matcher(text);
    while (m.find()) {
      ParsedStatement statement = ParsedStatement.fromMatcher(m);
      if (statement != null && statement.getVariable().startsWith(filter)) {
        ret.add(statement.getVariable());
      }
    }
    return ret;
  }
222740
public static Variable[] getVariables(NameSpace ns, String[] names) {
        if (null == ns || null == names)
            return new Variable[0];
        return Stream.of(names).map(name->getVariable(ns, name))
            .filter(Objects::nonNull).toArray(Variable[]::new);
    }
135728
public Object getVariableValue(String namespaceURI, String prefix, String localName) throws UnresolvableException {
        if (this.request.hasAttribute(localName)) {
            return String.valueOf(this.request.getAttribute(localName));
        }
        
        return null;
    }
1355393
public void setFilterSearchText(String value) {
        Element elt = getFilterSearchElt();
        if (elt == null) return;
        refreshFilterSearch(elt, value);
    }
169187
public static String convert(final String text, final List<String> vars) {
		String[] array = new String[vars.size()];
		StringBuilder sb = new StringBuilder();
		convert(sb,text,vars.toArray(array));
		return sb.toString();
	}
80166
def extract_literal(templatevar):
    
    # FilterExpression contains another 'var' that either contains a Variable or SafeData object.
    if hasattr(templatevar, 'var'):
        templatevar = templatevar.var
        if isinstance(templatevar, SafeData):
            # Literal in FilterExpression, can return.
            return templatevar
        else:
            # Variable in FilterExpression, not going to work here.
            return None

    if templatevar[0] in ('"', "'") and templatevar[-1] in ('"', "'"):
        return templatevar[1:-1]
    else:
        return None
90585
public static Variable lookup(String varName, BindingSet bindingSet) {
        if (bindingSet == null) {
            return null;
        }
        Binding binding = bindingSet.lookup(varName);
        return (binding != null) ? binding.getVariable() : null;
    }
1122150
public static filterhtmlinjectionvariable[] get(nitro_service service, String variable[]) throws Exception{
		if (variable !=null && variable.length>0) {
			filterhtmlinjectionvariable response[] = new filterhtmlinjectionvariable[variable.length];
			filterhtmlinjectionvariable obj[] = new filterhtmlinjectionvariable[variable.length];
			for (int i=0;i<variable.length;i++) {
				obj[i] = new filterhtmlinjectionvariable();
				obj[i].set_variable(variable[i]);
				response[i] = (filterhtmlinjectionvariable) obj[i].get_resource(service);
			}
			return response;
		}
		return null;
	}
1141075
public static sent_sms[] get_filtered(nitro_service service, String filter) throws Exception
	{
		sent_sms obj = new sent_sms();
		options option = new options();
		option.set_filter(filter);
		sent_sms[] response = (sent_sms[]) obj.getfiltered(service, option);
		return response;
	}
1029860
private static String getVariableName(String value) {
        assert value.charAt(0) == '{';
        assert value.charAt(value.length() - 1) == '}';
        return value.substring(1, value.length() - 1);
    }
952971
def int_filter(text):
    
    res = list()
    for char in text:
        if char.isdigit():
            res.append(char)
    return int("".join(res))
1112685
public VariableInfo findVariable(String name) {
    for (ContextLayer contextLayer : contextLayers) {
      VariableInfo variableInfo = contextLayer.getVariableInfo(name);
      if (variableInfo != null) {
        return variableInfo;
      }
    }

    return null;
  }
360522
public static HashMap<String, String> getUrlVariables(final Filter filter) {
        final HashMap<String, String> vars = new HashMap<String, String>();

        for (final FilterTag filterTag : filter.getFilterTags()) {
            final Tag tag = filterTag.getTag();
            final Integer tagState = filterTag.getTagState();

            if (tagState == CommonFilterConstants.MATCH_TAG_STATE) {
                vars.put(CommonFilterConstants.MATCH_TAG + tag.getTagId(), CommonFilterConstants.MATCH_TAG_STATE + "");
            } else if (tagState == CommonFilterConstants.NOT_MATCH_TAG_STATE) {
                vars.put(CommonFilterConstants.MATCH_TAG + tag.getTagId(), CommonFilterConstants.NOT_MATCH_TAG_STATE + "");
            } else if (tagState == CommonFilterConstants.GROUP_TAG_STATE) {
                vars.put(CommonFilterConstants.GROUP_TAG + tag.getTagId(), CommonFilterConstants.GROUP_TAG_STATE + "");
            }
        }

        for (final FilterCategory filterCategory : filter.getFilterCategories()) {
            final Category category = filterCategory.getCategory();
            final Project project = filterCategory.getProject();

            if (filterCategory.getCategoryState() == CommonFilterConstants.CATEGORY_INTERNAL_AND_STATE) {
                vars.put(
                        CommonFilterConstants.CATEORY_INTERNAL_LOGIC + category.getCategoryId() + (project == null ? "" : "-" + project
                                .getProjectId()),
                        CommonFilterConstants.AND_LOGIC);
            }

            // don't add a url var for the "or" internal logic, as this is the
            // default

            else if (filterCategory.getCategoryState() == CommonFilterConstants.CATEGORY_EXTERNAL_OR_STATE) {
                vars.put(
                        CommonFilterConstants.CATEORY_EXTERNAL_LOGIC + category.getCategoryId() + (project == null ? "" : "-" + project
                                .getProjectId()),
                        CommonFilterConstants.OR_LOGIC);
            }

            // don't add a url var for the "and" external logic, as this is the
            // default
        }

        int count = 1;
        for (final FilterLocale filterLocale : filter.getFilterLocales()) {
            final Integer localeState = filterLocale.getLocaleState();

            if (localeState == CommonFilterConstants.MATCH_TAG_STATE) {
                vars.put(CommonFilterConstants.MATCH_LOCALE + count, filterLocale.getLocaleName() + CommonFilterConstants.MATCH_TAG_STATE);
            } else if (localeState == CommonFilterConstants.NOT_MATCH_TAG_STATE) {
                vars.put(CommonFilterConstants.MATCH_LOCALE + count,
                        filterLocale.getLocaleName() + CommonFilterConstants.NOT_MATCH_TAG_STATE);
            }
            count++;
        }

        boolean foundFilterField = false;
        boolean foundFilterFieldLogic = false;
        for (final FilterField filterField : filter.getFilterFields()) {
            try {
                vars.put(filterField.getField(), URLEncoder.encode(filterField.getValue(), "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
            if (!filterField.getField().equals(CommonFilterConstants.LOGIC_FILTER_VAR)) foundFilterField = true;
            else foundFilterFieldLogic = true;
        }

        /*
         * if we have found some filter fields, but did not find the filter
         * logic, use the default value
         */
        if (foundFilterField && !foundFilterFieldLogic)
            vars.put(CommonFilterConstants.LOGIC_FILTER_VAR, FilterConstants.LOGIC_FILTER_VAR_DEFAULT_VALUE);

        return vars;
    }
1156570
private function _processVariable($text) {
		// Check the variable naming convention
		if (!in_array($text, $this->_systemVariables)) {
			$this->_checkVariableNaming($text);
		}

		// Check the variable name's length
		$this->_checkVariableNameLength($text);

		// Check if the variable is not a deprecated system variable
		$this->_checkDeprecation($text);

		// Check if the variable is not replaced
		$this->_checkReplacements($text);

		// Check if the variable is a function parameter
		if (!empty($this->_functionParameters[$text]) && $this->_inFunction) {

			$this->_functionParameters[$text] = "used";
		} else if (!$this->_inFunctionStatement) {

			// Global variable
			$pos = $this->tokenizer->getCurrentPosition();
			$nextTokenInfo = $this->tokenizer->peekNextValidToken($pos + 1);

			// if the next token is an equal, we suppose that this is an affectation
			$nextTokenText = $nextTokenInfo->text;
			$affectionTokens = array(
				'=',
				'+=',
				'*=',
				'/=',
				'-=',
				'%=',
				'&=',
				'|=',
				'^=',
				'<<=',
				'>>=',
				'.='
			);
			$isAffectation = in_array($nextTokenText, $affectionTokens);

			// Check if the variable has already been met
			if (empty($this->_variables[$text]) && !in_array($text, $this->_systemVariables)) {
				// The variable is met for the first time
				$variable = new VariableInfo();
				$variable->name = $text;
				$variable->line = $this->lineNumber; // We store the first declaration of the variable
				$this->_variables[$text] = $variable;
			} else if ($isAffectation) {
				// The variable is reaffected another value, this doesn't count as a valid use.
			} else {

				// Manage the case of $this->attribute
				if ($text === '$this') {

					$nextTokenInfo2 = $this->tokenizer->peekNextValidToken($nextTokenInfo->position);

					if ($this->tokenizer->checkToken($nextTokenInfo2, T_OBJECT_OPERATOR)) {

						// Detect $this inside a static function.
						if ($this->_functionStatic) {
							if ($this->_isActive('thisInStatic')) {
								$this->_writeError('thisInStatic', $this->_getMessage('THIS_IN_STATIC_FUNCTION'));
							}
						}

						$nextTokenInfo3 = $this->tokenizer->peekNextValidToken($nextTokenInfo2->position + 1);

						// This does not look like a function call, it should be a class attribute.
						// We eliminate the $this-> part
						$text = '$' . $nextTokenInfo3->text;
					}
				}

				// The variable is met again, we suppose we have used it for something
				if (!empty($this->_variables[$text])) {
					$variable = $this->_variables[$text];
					$variable->isUsed = true;
					$this->_variables[$text] = $variable;
				}
			}
		}
	}
13016
private List<VarDef> getVarsRemaining( FunctionInputDef inputDef, TestCaseDef testCase)
    {
    return getVarsRemaining( new VarDefIterator( inputDef), testCase);
    }
1351665
function filterVariablePath(props) {

	var filtered = [],
		literal = '',
		i = 0;
	for (i; i < props.length; i += 1) {
		if (props[i] && props[i].charAt(0) !== props[i].charAt(props[i].length - 1) &&
				(props[i].indexOf('"') === 0 || props[i].indexOf("'") === 0)) {
			literal = props[i];
			continue;
		}
		if (props[i] === '.' && literal) {
			literal += '.';
			continue;
		}
		if (props[i].indexOf('"') === props[i].length - 1 || props[i].indexOf("'") === props[i].length - 1) {
			literal += props[i];
			filtered.push(literal);
			literal = '';
		} else {
			filtered.push(props[i]);
		}
	}
	return _.compact(filtered);
}
828713
@SuppressWarnings("unchecked")
  public <T extends TypedValue> T getVariableTyped(String variableName) {
    TypedValue variable = associationManager.getVariable(variableName);
    return variable != null ? (T) (variable) : null;
  }