CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.9.0 (changelog, source)
Search

Class RegExpTerm

A regular expression term, that is, a syntactic part of a regular expression.

Regular expression terms may occur as part of a regular expression literal, such as /[a-z]+/, or as part of a string literal, such as "[a-z]+".

Note that some terms will occur as part of a string literal that isn’t actually interpreted as regular expression at runtime. Use isPartOfRegExpLiteral or isUsedAsRegExp to check if a term is really used as a regular expression.

Examples:

((ECMA|Java)[sS]cript)*$
((ECMA|Java)[sS]cript)*
(ECMA|Java)
$

Import path

import javascript

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

getAChild

Gets a child term of this term.

getAMatchedString

Gets a string that is matched by this regular-expression term.

getChild

Gets the ith child term of this term.

getConstantValue

Gets the single string this regular-expression term matches.

getLastChild

Gets the last child term of this term.

getLiteral

Gets the regular expression literal this term belongs to, if any.

getNumChild

Gets the number of child terms of this term.

getParent

Gets the parent term of this regular expression term, or the regular expression literal if this is the root term.

getPredecessor

Gets the regular expression term that is matched (textually) before this one, if any.

getRawValue

Gets the raw source text of this term.

getRootTerm

Gets the outermost term of this regular expression.

getSuccessor

Gets the regular expression term that is matched (textually) after this one, if any.

hasLocationInfo

Holds if this term has the specified location.

isInBackwardMatchingContext

Holds if this regular term is in a backward-matching context, that is, it has an enclosing lookbehind assertions.

isInForwardMatchingContext

Holds if this regular term is in a forward-matching context, that is, it has no enclosing lookbehind assertions.

isNullable

Holds if this regular expression term can match the empty string.

isPartOfRegExpLiteral

Holds if this term occurs as part of a regular expression literal.

isPartOfStringLiteral

Holds if this term occurs as part of a string literal.

isRootTerm

Holds if this is the root term of a regular expression.

isUsedAsRegExp

Holds if this term is part of a regular expression literal, or a string literal that is interpreted as a regular expression.

toString

Gets a textual representation of this element.

Inherited predicates

getAPrimaryQlClass

Gets the primary QL class for the Locatable.

from Locatable
getEndLine

Gets the line on which this element ends.

from Locatable
getFile

Gets the file this program element comes from.

from Locatable
getLocation

Gets this element’s location.

from Locatable
getNumLines

Gets the number of lines covered by this element.

from Locatable
getPrimaryQlClasses

Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

from Locatable
getStartLine

Gets the line on which this element starts.

from Locatable