HH\Lib\Regex\matches

Requires the Hack Standard Library to be installed.
Facebook Engineer?

This function is available as Regex\matches() in Facebook's 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;

Throws Invariant[Violation]Exception if $offset is not within plus/minus the length of $haystack.

Parameters

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

Returns

  • bool