classRegexp
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.
(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 $operandpublic Scalar $patternpublic bool $negated = falseMethods§
public function __construct(
public Scalar $operand,
public Scalar $pattern,
public bool $negated = false,
)Parameters
$operand | Scalar | The matched expression |
$pattern | Scalar | The regular expression |
$negated | bool | Whether NOT is written before REGEXP |
Calls 6
- new Precedence line 44
- static-call Check::input() line 45
- method-call Precedence::fits() line 45
- class-const Precedence::PREDICATE() line 45
- class-const Precedence::BIT_EXPR() line 45
- method-call Precedence::admits() line 46
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives both operands and combines their NULL facts.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- new Operands line 54
- method-call Operands::single() line 55
- method-call Derivation::scalar() line 55
- method-call Operands::truth() line 58
public function render(Output $out): voidWrites the operand, the optional NOT, REGEXP and the pattern.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::node() line 66
- method-call Output::keyword() line 68
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.