HH\Lib\Regex\matches

Meta Engineer?

This is available as Regex\matches in the www repository.

Returns whether a match exists in $haystack given the regex pattern $pattern and an optional offset at which to start the search

namespace HH\Lib\Regex;

function matches(
  string $haystack,
  Pattern<Match> $pattern,
  int $offset = 0,
): bool;

The regex pattern follows the PCRE library: https://www.pcre.org/original/doc/html/pcresyntax.html.

Throws InvariantException if $offset is not within plus/minus the length of $haystack.

Guide

Parameters

  • string $haystack
  • Pattern<Match> $pattern
  • int $offset = 0

Returns

  • bool