public static function matchRegex($sContent, $sPattern, $iIndex = null)
    {
        preg_match_all($sPattern, $sContent, $aMatches);
        if ($aMatches === false) {
            return false;
        }
        if ($iIndex !== null && is_int($iIndex)) {
            if (isset($aMatches[$iIndex][0])) {
                return $aMatches[$iIndex][0];
            }

            return false;
        }

        return $aMatches;
    }
public static function matchRegex($sContent, $sPattern, $iIndex = null)
    {
        preg_match_all($sPattern, $sContent, $aMatches);
        if ($aMatches === false) {
            return false;
        }
        if ($iIndex !== null && is_int($iIndex)) {
            if (isset($aMatches[$iIndex][0])) {
                return $aMatches[$iIndex][0];
            }

            return false;
        }

        return $aMatches;
    }
public static function matchRegex ( $ sContent , $ sPattern , $ iIndex = null ) { preg_match_all ( $ sPattern , $ sContent , $ aMatches ) ; if ( $ aMatches === false ) { return false ; } if ( $ iIndex !== null && is_int ( $ iIndex ) ) { if ( isset ( $ aMatches [ $ iIndex ] [ 0 ] ) ) { return $ aMatches [ $ iIndex ] [ 0 ] ; } return false ; } return $ aMatches ; }
Regular expression helper.

@param string $sContent The content to search in.
@param string $sPattern The regular expression.
@param null   $iIndex   The index to return.

@return bool   If no match was found.
@return string If one match was found.
@return array  If more than one match was found.
Regular expression helper .