phpbotgram

RegexpMode : string
in package

Regex-evaluation mode selector for `MagicFilter::regexp(...)`.

Mirrors upstream magic_filter.magic.RegexpMode (magic_filter/magic.py:33-38). Python upstream uses string constants; we use a typed enum for type safety and PHPStan-friendliness.

Mode semantics — PHP-side mappings since upstream relies on Python's re.Pattern API and PHP's PCRE wrappers behave differently:

  • MATCHpreg_match($pattern, $subject) anchored at the start of the subject (we automatically prepend \A when building the pattern).
  • FULLMATCHpreg_match anchored at both ends (we wrap the pattern in \A(?:…)\z).
  • SEARCHpreg_match($pattern, $subject) un-anchored — the default PCRE behaviour.
  • FINDALLpreg_match_all returning the list of matched strings.
  • FINDITER → same as FINDALL in PHP; we materialise rather than expose an iterator because PHP's preg_match_all is single-shot. Functionally identical to FINDALL from the user's perspective.

Table of Contents

Cases

FINDALL  = 'findall'
FINDITER  = 'finditer'
FULLMATCH  = 'fullmatch'
MATCH  = 'match'
SEARCH  = 'search'

Cases

On this page

Search results