src/Dictionary/Pattern.php
public function setPattern($pattern)
    {
        $item = trim($pattern);
        $strlen = mb_strlen($item);
        $return = array();
        for ($i = 0; $i < $strlen; $i++) {
            if ((($i) <= $strlen) && preg_match('/[0-9]/u', mb_substr($item, $i, 1))) {
                $this->pattern .= mb_substr($item, $i, 1);
                $i++;
            } else {
                $this->pattern .= '0';
            }
        }
        $this->text = preg_replace(array('/[0-9]/u','/\'/u'), array('','\\’'), $item);
        if (strlen($this->pattern) == mb_strlen($this->text)) {
            $this->pattern .= '0';
        }

        return $this;
    }
public function setPattern($pattern)
    {
        $item = trim($pattern);
        $strlen = mb_strlen($item);
        $return = array();
        for ($i = 0; $i < $strlen; $i++) {
            if ((($i) <= $strlen) && preg_match('/[0-9]/u', mb_substr($item, $i, 1))) {
                $this->pattern .= mb_substr($item, $i, 1);
                $i++;
            } else {
                $this->pattern .= '0';
            }
        }
        $this->text = preg_replace(array('/[0-9]/u','/\'/u'), array('','\\’'), $item);
        if (strlen($this->pattern) == mb_strlen($this->text)) {
            $this->pattern .= '0';
        }

        return $this;
    }
Set the pattern.

@param string $pattern The UTF-8 encoded Pattern to store

@return Pattern