CodeQL library for Swift
codeql/swift-all 6.8.4 (changelog, source)
Search

Class RegExp

A Expr containing a regular expression term, that is, either a regular expression literal, or a string literal used in a context where it is parsed as regular expression.

Import path

import codeql.swift.regex.internal.ParseRegex

Direct supertypes

Indirect supertypes

Known direct subtypes

    Predicates

    alternation

    Whether the text in the range start,end is an alternation

    alternationOption

    Whether the text in the range start,end is an alternation and the text in partStart, partEnd is one of the options in that alternation.

    backreference

    Whether the text in the range start,end is a back reference

    charRange

    Holds if the character set starting at charsetStart contains a character range with lower bound found between start and lowerEnd and upper bound found between upperStart and end.

    charSet

    Whether there is a character class, between start (inclusive) and end (exclusive).

    charSetChild

    Holds if the character set starting at charsetStart contains either a character or a range found between start and end.

    charSetDelimiter

    Helper predicate for chars that could be character-set delimiters. Holds if the (non-escaped) char at pos in the string, is the (one-based) index occurrence of a bracket ([ or ]) in the string. Result if true is the char is [, and false if the char is ].

    charSetStart

    Helper predicate for charSetStart(int start, int end).

    charSetStart

    Holds if a character set starts between start and end.

    character

    Holds if a simple or escaped character is found between start and end.

    emptyGroup

    Holds if an empty group is found between start and end.

    escapedCharacter

    Holds if an escaped character is found between start and end. Escaped characters include hex values, octal values and named escapes, but excludes backreferences.

    escapingChar

    Holds if the character at pos is a "" that is actually escaping what comes after.

    failedToParse

    Holds if the ith character could not be parsed.

    firstItem

    Whether the item at [start, end) is one of the first items to be matched.

    getAMode

    Gets a mode (if any) of this regular expression in any evaluation. Can be any of: IGNORECASE VERBOSE DOTALL MULTILINE UNICODEBOUNDARY UNICODE

    getBackRefName

    Gets the name, if it has one, of the back reference in start,end

    getBackRefNumber

    Gets the number of the back reference in start,end

    getChar

    Gets the ith character of this regex

    getCharacterPropertyName

    Gets the name of the character property in start,end

    getFlags

    Gets a string representing the flags for this RegExp, or the empty string if it has no flags.

    getGroupName

    Gets the name, if it has one, of the group in start,end

    getGroupNumber

    Gets the number of the group in start,end

    getModeFromPrefix

    Gets a mode of this regular expression string if it is defined by a mode prefix.

    getText

    Gets the text of this regex.

    group

    Whether the text in the range start,end is a group

    groupContents

    Matches the contents of a group.

    inCharSet

    Holds if the character at index is inside a character set.

    inPosixBracket

    Holds if the character at index is inside a posix bracket.

    isDotAll

    Holds if this RegExp has the s flag for multi-line matching.

    isIgnoreCase

    Holds if this RegExp has the i flag for case-insensitive matching.

    item

    Holds if the range start, end contains a character, a quantifier, a character set or a group.

    lastItem

    Whether the item at [start, end) is one of the last items to be matched.

    multiples

    Holds if a repetition quantifier is found between start and end, with the given lower and upper bounds. If a bound is omitted, the corresponding string is empty.

    namedBackreference

    Matches a named backreference, e.g. \k<foo>.

    namedCharacterProperty

    Matches named character properties such as \p{Word} and [[:digit:]]

    namedCharacterPropertyIsInverted

    Holds if the named character property is inverted. Examples for which it holds: - \P{Digit} upper-case P means inverted - \p{^Word} caret also means inverted (not supported in Swift Regex but it may be in other regex parsers or in future versions of Swift). - [[:^digit:]]

    negativeLookaheadAssertionGroup

    Holds if a negative lookahead is found between start and end

    negativeLookbehindAssertionGroup

    Holds if a negative lookbehind is found between start and end

    nonEscapedCharAt

    Gets the ith character of this regex, unless it is part of a character escape sequence.

    normalCharacter

    Holds if a normal character is found between start and end.

    normalCharacterSequence

    Holds if the range [start:end) consists of only ‘normal’ characters.

    numberedBackreference

    Matches a numbered backreference, e.g. \1.

    positiveLookaheadAssertionGroup

    Holds if a positive lookahead is found between start and end

    positiveLookbehindAssertionGroup

    Holds if a positive lookbehind is found between start and end

    qualifiedItem

    Whether the text in the range start,end is a qualified item, where item is a character, a character set or a group.

    qualifiedPart

    Holds if a qualified part is found between start and partEnd and the qualifier is found between partEnd and end.

    sequence

    Whether the text in the range start,end is a sequence of 1 or more items, where an item is a character, a character set or a group.

    specialCharacter

    Holds if a special character is found between start and end.

    zeroWidthMatch

    Whether the text in the range start, end is a group and can match the empty string.

    Inherited predicates

    convertsFromfrom Expr
    getAPrimaryQlClass

    Gets the name of a primary CodeQL class to which this element belongs.

    from Element
    getConversionfrom Expr
    getConversionfrom Expr
    getEnclosingCallable

    Gets the nearest Callable that contains this AST node, if any. This includes (auto)closures, functions, methods, (de)initializers, and accessors.

    from AstNode
    getEnclosingDecl

    Gets the nearest declaration that contains this AST node, if any.

    from AstNode
    getEnclosingFunction

    Gets the nearest function definition that contains this AST node, if any. This includes functions, methods, (de)initializers, and accessors, but not closures.

    from AstNode
    getFile

    Gets the primary file where this element occurs.

    from Locatable
    getFullyConvertedfrom Expr
    getFullyUnresolvedfrom Element
    getImmediateType

    Gets the type of this expression, if it exists.

    from Expr
    getLocation

    Gets the location associated with this element in the code, if it exists.

    from Locatable
    getPrimaryQlClasses

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

    from Element
    getResolveStep

    Gets the most immediate element that should substitute this element in the explicit AST, if any. Classes can override this to indicate this node should be in the “hidden” AST, mostly reserved for conversions and syntactic sugar nodes like parentheses.

    from Expr
    getType

    Gets the type of this expression, if it exists.

    from Expr
    getUnconvertedfrom Expr
    hasConversionsfrom Expr
    hasLocation

    Holds if getLocation() exists.

    from Locatable
    hasType

    Holds if getType() exists.

    from Expr
    isConversionfrom Expr
    isUnknown

    Holds if this element is unknown.

    from Element
    resolve

    Gets the element that should substitute this element in the explicit AST, applying getResolveStep transitively.

    from Element
    toString

    Gets the string representation of this element.

    from Element
    toStringImpl

    INTERNAL: Do not use.

    from Element