DXNRegex
in package
implements
DXNValueInterface
DXN `regex` (`~r/pattern/flags`) -- PCRE-style semantics (matching Erlang `:re`/Elixir `Regex`, per `dxn/DXN.md` ยง2.3), which happens to make PHP's own PCRE-backed `preg_*` a *better* native fit than JS's `RegExp` had: DXN's `x` (extended) and `r` (ungreedy) flags both have real PHP modifier equivalents (`r` maps to PHP's uppercase `U`, distinct from lowercase `u`/unicode) where JS had neither. Only `f` (firstline) has no PHP preg modifier to reach for, so {@see self::toPcrePattern()} is guarded on that alone, not on `x`/`f`/`r` wholesale.
Table of Contents
Interfaces
- DXNValueInterface
- Implemented by every `DXN*` wrapper class -- the PHP analog of the `dxnType` string tag used for kind dispatch in the JS port, and of `Dextrin.Value`'s closed type union in the Elixir original. Native PHP values (`null`, `bool`, `int`, `float`, `string`, and `array` for `map`/`array`) never implement this; {@see Equality::kindOf()} handles those directly.
Constants
- DXN_TYPE : mixed = 'regex'
- FLAG_NAMES : mixed = ['i', 'm', 's', 'u', 'x', 'f', 'r']
Properties
Methods
- __construct() : mixed
- compareTo() : int
- A total order against any other DXN value, not just another instance of this class -- backs {@see DXNSortedSet}. Cross-kind ordering is implementation-defined per DXN.md; within a kind, uses the kind's own natural order where one exists, or a deterministic structural fallback where it doesn't.
- dxnType() : string
- The DXN type name this value represents, e.g. "symbol", "uuid".
- equals() : bool
- Structural equality, recursing into nested DXN values as needed.
- fromPcrePattern() : self
- toPcrePattern() : string
Constants
DXN_TYPE
private
mixed
DXN_TYPE
= 'regex'
FLAG_NAMES
private
mixed
FLAG_NAMES
= ['i', 'm', 's', 'u', 'x', 'f', 'r']
Properties
$flags read-only
public
array<string, bool>
$flags
keys: i, m, s, u, x, f, r
$pattern read-only
public
string
$pattern
Methods
__construct()
public
__construct(string $pattern[, array<string, bool> $flags = [] ]) : mixed
Parameters
- $pattern : string
- $flags : array<string, bool> = []
compareTo()
A total order against any other DXN value, not just another instance of this class -- backs {@see DXNSortedSet}. Cross-kind ordering is implementation-defined per DXN.md; within a kind, uses the kind's own natural order where one exists, or a deterministic structural fallback where it doesn't.
public
compareTo(mixed $other) : int
Parameters
- $other : mixed
Return values
intdxnType()
The DXN type name this value represents, e.g. "symbol", "uuid".
public
dxnType() : string
Return values
stringequals()
Structural equality, recursing into nested DXN values as needed.
public
equals(mixed $other) : bool
Parameters
- $other : mixed
Return values
boolfromPcrePattern()
public
static fromPcrePattern(string $pcrePattern) : self
Parameters
- $pcrePattern : string
Return values
selftoPcrePattern()
public
toPcrePattern([string $delimiter = '/' ]) : string
Parameters
- $delimiter : string = '/'