protected function replaceRuleVariables(array $rules, array $attributes)
	{
		array_walk_recursive($rules, function(&$item, $key) use($attributes) {
			// don't mess with regex rules
			if (substr($item, 0, 6) === 'regex:') return;

			// replace explicit variables
			foreach ($this->replace as $key => $value) {
				if (strpos($item, "<$key>") !== false) {
					$item = str_replace("<$key>", $value, $item);
				}
			}

			// replace input variables
			foreach ($attributes as $key => $value) {
				if (strpos($item, "[$key]") !== false) {
					$item = str_replace("[$key]", $value, $item);
				}
			}
		});

		return $rules;
	}