public function matchAll($regex)
    {
        $matches = array();
        $result = preg_match_all($regex, $this->toString(), $matches, PREG_SET_ORDER);
        if($this->isValidRegex($regex) && $result!==false && $result>0)
        {
            return ArrayList::asObjectArray($matches);
        }
        return null;
    }