final class Regexp
    implements Scalar
    uses Snapshot
Public API: explicitly declared with @visibility public.

A regular expression match: x [NOT] REGEXP pattern (Item_func_regex, Item_func_regexp_like in 8.0 and later).

RLIKE is the same keyword to the lexer and is written REGEXP. Both operands are bit_expr (MYSQL-PRECEDENCE-001).

Rule: MYSQL-REGEXP-001. Facts: 1, 0 or NULL, an integer; it can be NULL when an operand can. Both operands take a single value. Terminates: the operands are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/regexp.html#operator_regexp. Status: Implemented.

Writing RLIKE as REGEXPdoctest
(new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT a FROM t WHERE a NOT RLIKE '^x'")->toString() // => "SELECT a FROM t WHERE a NOT REGEXP '^x'"

Properties§

public Scalar $operand
public Scalar $pattern
public bool $negated = false

Methods§

public function __construct(
    public Scalar $operand,
    public Scalar $pattern,
    public bool $negated = false,
)

Parameters

$operandScalarThe matched expression
$patternScalarThe regular expression
$negatedboolWhether NOT is written before REGEXP
Calls 6
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives both operands and combines their NULL facts.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 4
public function render(Output $out): void

Writes the operand, the optional NOT, REGEXP and the pattern.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 4§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Type checks 1