protected static function replaceWithRule($rule, $output)
    {
        foreach ($rule as $data) {

            $from_json = $data["from"];

            //search line break.
            //if line break include , need to fix the line
            if (strpos($from_json, chr(13)) !== false) {
                $from_json = self::parseline($from_json);
            }

            $from = "~".json_decode('"'.$from_json.'"')."~u";
            $to = json_decode('"'.$data["to"].'"');
            $output = preg_replace($from, $to, $output);
        }

        return $output;
    }