private function getMatches($rawHtml, $htmlTag, $matchRemainder, $matchAll)
    {
        $matches = null;
        $matchRemainder = $matchRemainder ? '(.*)' : '';
        $regex = sprintf("~^([ \t]*)%s%s~mi", $htmlTag, $matchRemainder);

        if ($matchAll && preg_match_all($regex, $rawHtml, $matches)) {
            return $matches;
        } elseif (!$matchAll && preg_match($regex, $rawHtml, $matches)) {
            return $matches;
        }

        return false;
    }
private function getMatches($rawHtml, $htmlTag, $matchRemainder, $matchAll)
    {
        $matches = null;
        $matchRemainder = $matchRemainder ? '(.*)' : '';
        $regex = sprintf("~^([ \t]*)%s%s~mi", $htmlTag, $matchRemainder);

        if ($matchAll && preg_match_all($regex, $rawHtml, $matches)) {
            return $matches;
        } elseif (!$matchAll && preg_match($regex, $rawHtml, $matches)) {
            return $matches;
        }

        return false;
    }
private function getMatches ( $ rawHtml , $ htmlTag , $ matchRemainder , $ matchAll ) { $ matches = null ; $ matchRemainder = $ matchRemainder ? '(.*)' : '' ; $ regex = sprintf ( "~^([ \t]*)%s%s~mi" , $ htmlTag , $ matchRemainder ) ; if ( $ matchAll && preg_match_all ( $ regex , $ rawHtml , $ matches ) ) { return $ matches ; } elseif ( ! $ matchAll && preg_match ( $ regex , $ rawHtml , $ matches ) ) { return $ matches ; } return false ; }
Get a set of matches.

@param string $rawHtml        The original HTML
@param string $htmlTag        HTML tag fragment we're matching, e.g. '<head' or '</head'
@param bool   $matchRemainder TRUE matches the remainder of the line, not just the tag - (.*)
@param bool   $matchAll       TRUE returns all matched instances - preg_match_all()

@return string[]|false
Get a set of matches .